Re: 10963 - The Swallowing Ground
Posted: Wed Nov 20, 2013 10:19 pm
Change line 19 to:
for (j = 0; j < cols; j++)
for (j = 0; j < cols; j++)
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
printf("\n");
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if(m==0) printf("yes\n\n");
else printf("no\n\n");
m=0;
}
return 0;
}
Code: Select all
removed after ac
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
//printf("\n");
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if (i>0) printf("\n\n");
if(m==0) printf("yes");
else printf("no");
m=0;
}
return 0;
}
Code: Select all
#include <stdio.h>
int main()
{
int a,b,c,d,k,m=0,n,i,j;
int arr[1000];
scanf("%d",&a);
for (i=0;i<a;i++){
scanf("%d",&b);
c=0;
d=0;
k=b;
for (j=0;j<b;j++){
scanf("%d %d",&c,&d);
n=c-d;
if(n<0) n=n*(-1);
arr[j] = n;
}
}
for(i=0;i<a;i++){
for(j=0;j<k-1;j++){
if(arr[j+1] != arr[j]) m=1;
}
if (i>0) printf("\n\n");
if(m==0) printf("yes");
else printf("no");
m=0;
}
return 0;
}
Code: Select all
2
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
yes
yes
Process returned 0 (0x0) execution time : 6.407 s
Press any key to continue.
Code: Select all
2
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
Code: Select all
yes
yes
I didn't print too much lines...The outputs of two consecutive cases will be separated by a blank line. You are both printing too many blank lines.
Code: Select all
3
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
5
2 1
0 -1
1 0
1 0
2 1
yes
yes
yes
Process returned 0 (0x0) execution time : 20.840 s
Press ENTER to continue.
The last code that you posted isn't printing a newline char at the end of the last line. You are printing: "yes\n\nyes"brianfry713 wrote:Input:AC outputCode: Select all
2 5 2 1 0 -1 1 0 1 0 2 1 5 2 1 0 -1 1 0 1 0 2 1
or as a string: "yes\n\nyes\n"Code: Select all
yes yes
I submitted as you said but I still got a WA... What should I do...The last code that you posted isn't printing a newline char at the end of the last line. You are printing: "yes\n\nyes"
Code: Select all
removed after ac
Code: Select all
removed after ac