|
|
back to boardWA12. #include<stdio.h> int a[2001][330]; int main() { int n; for(int i=0; i<2001; i++) { for(int j=0; j<330; j++) { a[i][j]=0; } } scanf("%d", &n);
a[1][329]=1; a[2][329]=4; a[3][329]=8; for(int i=4; i<2001; i++) { for(int j=329; j>0; j--) { if((i%2)==0) { a[i][j]=a[i][j]+(2*a[i-1][j])%10-a[i-2][j]; if(a[i][j]<0) { a[i][j]=a[i][j]+10; a[i][j-1]=a[i][j-1]-1; } if(a[i][j]>10) { a[i][j]=a[i][j]%10; a[i][j-1]=a[i][j-1]+a[i][j]/10; } if(2*a[i-1][j]>9) { a[i][j-1]=a[i][j-1]+(2*a[i-1][j])/10; } } else { a[i][j]=a[i][j]+(3*a[i-1][j])%10-(2*a[i-2][j])%10; if(a[i][j]<0) { a[i][j]=a[i][j]+10; a[i][j-1]=a[i][j-1]-1; } if(a[i][j]>10) { a[i][j]=a[i][j]%10; a[i][j-1]=aa[i][j-1]+[i][j]/10; } if(3*a[i-1][j]>9) { a[i][j-1]=a[i][j-1]+(3*a[i-1][j])/10; } if(2*a[i-2][j]>9) { a[i][j-1]=a[i][j-1]-(2*a[i-2][j])/10; } } } } for(int i=0; i<330; i++) { if(a[n][i]!=0) { for(int j=i; j<330; j++) { printf("%d", a[n][j]); } printf("\n"); goto A; } } A: return 0; } All tests are right, but I can't understand why WA12? |
|
|