×

# How to test my answer perfectly ?

 0 I am getting correct answer for my code. But it still gives WA on submitting. Can you suggest the test case for which my code may fail. asked 03 Sep '12, 13:16 1●1●1●1 accept rate: 0%

problem:ChefTown code:

# include<stdio.h>

int a[400002]; int max(int,int); int main() { int n,w,maxp,p,q,count=0,i; long long int sum=0; scanf("%d",&n); scanf("%d",&w); for(i=0;i<n;i++) {="" scanf("%d",&a[i]);="" }="" for(i="0;i&lt;w;i++)" sum+="a[i];" maxp="max(0,w);" p="a[0];" for(i="0;i&lt;=n-w;i++)" {="" if(sum="=(w*(w+1))/2+(w*(maxp-w)))" count++;="" if(i!="(n-w))" {="" sum="sum+a[i+w]-p;" if(a[i+w]="">maxp) maxp=a[i+w]; else if(p==maxp) maxp=max(i+1,w+i+1); p=a[i+1];

    }
}
printf("%d",count);
return 0;


} max(j,w){ int max=0,i; for(i=j;i<w+j;i++) {="" if(a[i]="">max) max=a[i]; } return max; }

1111
accept rate: 0%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,321

question asked: 03 Sep '12, 13:16

question was seen: 1,185 times

last updated: 03 Sep '12, 13:17