/ Vijos /

记录详情

Compile Error

foo.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include <stdio.h>
         ^
foo.c:8:10: error: 'maxn' undeclared here (not in a function)
 char ch2[maxn];
          ^
foo.c: In function 'main':
foo.c:14:1: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
 scanf("%s%s",ch1,ch2); int i,j,x=0,y=0; int k1=strlen(ch1); int k2=strlen(ch2); for(i=1;i<=k1;i+=4) { a[++x]=ch1[k1-i]-'0'; if( i+1<=k1 ) a[x]+=( ch1[k1-i-1]-'0' )*10; if( i+2<=k1 ) a[x]+=( ch1[k1-i-2]-'0' )*100; if( i+3<=k1 ) a[x]+=( ch1[k1-i-3]-'0' )*1000; } for(i=1;i<=k2;i+=4) { b[++y]=ch2[k2-i]-'0'; if( i+1<=k2 ) b[y]+=( ch2[k2-i-1]-'0' )*10; if( i+2<=k2 ) b[y]+=( ch2[k2-i-2]-'0' )*100; if( i+3<=k2 ) b[y]+=( ch2[k2-i-3]-'0' )*1000; } for(i=1;i<=x;i++) for(j=1;j<=y;j++) { c[i+j-1]+=a[i]*b[j]; c[i+j]+=c[i+j-1]/10000; c[i+j-1]%=10000; } for(i=x+y;i>=1;i--) if( c[i] ) break; for(j=i;j>=1;j--) { if( i==j ) printf("%d",c[j]); else printf("%04d",c[j]); } putchar(10); return 0; }
 ^
foo.c:14:1: warning: incompatible implicit declaration of built-in function 'scanf'
foo.c:14:14: error: 'ch1' undeclared (first use in this function)
 scanf("%s%s",ch1,ch2); int i,j,x=0,y=0; int k1=strlen(ch1); int k2=strlen(ch2); for(i=1;i<=k1;i+=4) { a[++x]=ch1[k1-i]-'0'; if( i+1<=k1 ) a[x]+=( ch1[k1-i-1]-'0' )*10; if( i+2<=k1 ) a[x]+=( ch1[k1-i-2]-'0' )*100; if( i+3<=k1 ) a[x]+=( ch1[k1-i-3]-'0' )*1000; } for(i=1;i<=k2;i+=4) { b[++y]=ch2[k2-i]-'0'; if( i+1<=k2 ) b[y]+=( ch2[k2-i-1]-'0' )*10; if( i+2<=k2 ) b[y]+=( ch2[k2-i-2]-'0' )*100; if( i+3<=k2 ) b[y]+=( ch2[k2-i-3]-'0' )*1000; } for(i=1;i<=x;i++) for(j=1;j<=y;j++) { c[i+j-1]+=a[i]*b[j]; c[i+j]+=c[i+j-1]/10000; c[i+j-1]%=10000; } for(i=x+y;i>=1;i--) if( c[i] ) break; for(j=i;j>=1;j--) { if( i==j ) printf("%d",c[j]); else printf("%04d",c[j]); } putchar(10); return 0; }
              ^
foo.c:14:14: note: each undeclared identifier is reported only once for each function it appears in
foo.c:14:1: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
 scanf("%s%s",ch1,ch2); int i,j,x=0,y=0; int k1=strlen(ch1); int k2=strlen(ch2); for(i=1;i<=k1;i+=4) { a[++x]=ch1[k1-i]-'0'; if( i+1<=k1 ) a[x]+=( ch1[k1-i-1]-'0' )*10; if( i+2<=k1 ) a[x]+=( ch1[k1-i-2]-'0' )*100; if( i+3<=k1 ) a[x]+=( ch1[k1-i-3]-'0' )*1000; } for(i=1;i<=k2;i+=4) { b[++y]=ch2[k2-i]-'0'; if( i+1<=k2 ) b[y]+=( ch2[k2-i-1]-'0' )*10; if( i+2<=k2 ) b[y]+=( ch2[k2-i-2]-'0' )*100; if( i+3<=k2 ) b[y]+=( ch2[k2-i-3]-'0' )*1000; } for(i=1;i<=x;i++) for(j=1;j<=y;j++) { c[i+j-1]+=a[i]*b[j]; c[i+j]+=c[i+j-1]/10000; c[i+j-1]%=10000; } for(i=x+y;i>=1;i--) if( c[i] ) break; for(j=i;j>=1;j--) { if( i==j ) printf("%d",c[j]); else printf("%04d",c[j]); } putchar(10); return 0; }
 ^
foo.c:14:48: warning: incompatible implicit declaration of built-in function 'strlen'
 scanf("%s%s",ch1,ch2); int i,j,x=0,y=0; int k1=strlen(ch1); int k2=strlen(ch2); for(i=1;i<=k1;i+=4) { a[++x]=ch1[k1-i]-'0'; if( i+1<=k1 ) a[x]+=( ch1[k1-i-1]-'0' )*10; if( i+2<=k1 ) a[x]+=( ch1[k1-i-2]-'0' )*100; if( i+3<=k1 ) a[x]+=( ch1[k1-i-3]-'0' )*1000; } for(i=1;i<=k2;i+=4) { b[++y]=ch2[k2-i]-'0'; if( i+1<=k2 ) b[y]+=( ch2[k2-i-1]-'0' )*10; if( i+2<=k2 ) b[y]+=( ch2[k2-i-2]-'0' )*100; if( i+3<=k2 ) b[y]+=( ch2[k2-i-3]-'0' )*1000; } for(i=1;i<=x;i++) for(j=1;j<=y;j++) { c[i+j-1]+=a[i]*b[j]; c[i+j]+=c[i+j-1]/10000; c[i+j-1]%=10000; } for(i=x+y;i>=1;i--) if( c[i] ) break; for(j=i;j>=1;j--) { if( i==j ) printf("%d",c[j]); else printf("%04d",c[j]); } putchar(10); return 0; }
                                                ^
foo.c:14:1: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
 scanf("%s%s",ch1,ch2); int i,j,x=0,y=0; int k1=strlen(ch1); int k2=strlen(ch2); for(i=1;i<=k1;i+=4) { a[++x]=ch1[k1-i]-'0'; if( i+1<=k1 ) a[x]+=( ch1[k1-i-1]-'0' )*10; if( i+2<=k1 ) a[x]+=( ch1[k1-i-2]-'0' )*100; if( i+3<=k1 ) a[x]+=( ch1[k1-i-3]-'0' )*1000; } for(i=1;i<=k2;i+=4) { b[++y]=ch2[k2-i]-'0'; if( i+1<=k2 ) b[y]+=( ch2[k2-i-1]-'0' )*10; if( i+2<=k2 ) b[y]+=( ch2[k2-i-2]-'0' )*100; if( i

信息

递交者
类型
递交
题目
P1040 高精度乘法
语言
C
递交时间
2015-07-18 10:24:00
评测时间
2015-07-18 10:24:02
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes