很有趣的ZOJ
是不是zoj不能添加注释的啊?很奇怪。
这是1057的AC代码
#include"stdio.h" #include"math.h" int main() { int n,j; for(j=0;;j++) { scanf("%d",&n); if(n==0) break; if(j) printf("\n"); int a[20],b[20],i; int aa=0,bb=0; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) { scanf("%d",&b[i]); if(b[i]==2&&a[i]==1) aa+=6; else if(b[i]==1&&a[i]==2) bb+=6; else if(abs(b[i]-a[i])==1) { if(a[i]<b[i]) aa+=a[i]+b[i]; else bb+=a[i]+b[i]; } else if(abs(b[i]-a[i])>1) { if(a[i]>b[i]) aa+=a[i]; else bb+=b[i]; } else ; } printf("A has %d points. B has %d points.\n",aa,bb); } return 0; }
添加一行注释之后
#include"stdio.h" #include"math.h" int main() { int n,j; //不是吧,注释不行的吗 for(j=0;;j++) { scanf("%d",&n); if(n==0) break; if(j) printf("\n"); int a[20],b[20],i; int aa=0,bb=0; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) { scanf("%d",&b[i]); if(b[i]==2&&a[i]==1) aa+=6; else if(b[i]==1&&a[i]==2) bb+=6; else if(abs(b[i]-a[i])==1) { if(a[i]<b[i]) aa+=a[i]+b[i]; else bb+=a[i]+b[i]; } else if(abs(b[i]-a[i])>1) { if(a[i]>b[i]) aa+=a[i]; else bb+=b[i]; } else ; } printf("A has %d points. B has %d points.\n",aa,bb); } return 0; }
出现这个错误信息
p.c: In function 'main': p.c:6: error: expected expression before '/' token p.c:6: error: stray '\344' in program p.c:6: error: stray '\270' in program p.c:6: error: stray '\215' in program p.c:6: error: stray '\346' in program p.c:6: error: stray '\230' in program p.c:6: error: stray '\257' in program p.c:6: error: stray '\345' in program p.c:6: error: stray '\220' in program p.c:6: error: stray '\247' in program p.c:6: error: stray '\357' in program p.c:6: error: stray '\274' in program p.c:6: error: stray '\214' in program p.c:6: error: stray '\346' in program p.c:6: error: stray '\263' in program p.c:6: error: stray '\250' in program p.c:6: error: stray '\351' in program p.c:6: error: stray '\207' in program p.c:6: error: stray '\212' in program p.c:6: error: stray '\344' in program p.c:6: error: stray '\270' in program p.c:6: error: stray '\215' in program p.c:6: error: stray '\350' in program p.c:6: error: stray '\241' in program p.c:6: error: stray '\214' in program p.c:6: error: stray '\347' in program p.c:6: error: stray '\232' in program p.c:6: error: stray '\204' in program p.c:6: error: stray '\345' in program p.c:6: error: stray '\220' in program p.c:6: error: stray '\227' in program p.c:5: warning: unused variable 'j' p.c:5: warning: unused variable 'n'
然后用/* */注释之后,错误信息变成
p.cc: In function 'int main()': p.cc:26: error: 'abs' was not declared in this scope然后用英文添加注释
/* cao can you support english*/
出现错误信息
p.cc: In function 'int main()': p.cc:26: error: 'abs' was not declared in this scope