結果
問題 | No.432 占い(Easy) |
ユーザー |
|
提出日時 | 2016-11-16 15:05:25 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 569 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 02:17:03 |
合計ジャッジ時間 | 1,196 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&t); | ^~~~~~~~~~~~~~ main.c:19:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%s",s); | ^~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> void cpy(int f[],int t[]){ int i; for(i=0;i<=1023;i++){t[i] = f[i];} } void res(int d[]){ int i; for(i=0;i<=1023;i++){d[i]=0;} } int main(void) { int t,m[1024],n[1024],i,j,k,l,a; char s[1024]; scanf("%d",&t); for(i = 1;i <= t;i++){ scanf("%s",s); l = strlen(s); for(j = 0;j < l;j++){ m[j] = s[j] - 48; } for(j = l-1;j >= 1;j--){ res(n); for(k = j;k >= 1;k--){ a = m[k] + m[k-1]; if(a <= 9){n[k-1] = a;} else{n[k-1] = a%10 + 1;} } cpy(n,m); } printf("%d\n",m[0]); } return 0; }