結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2017-02-07 12:13:42 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 10:06:51 |
合計ジャッジ時間 | 1,183 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%*c",&T); | ^~~~~~~~~~~~~~~~~ main.c: In function ‘solve’: main.c:17:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%s%*c",str); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<string.h> void solve(void); int main(void){ int T; scanf("%d%*c",&T); while(T--) solve(); return 0; } void solve(void){ char str[1024]; int i,ans; int num,l; scanf("%s%*c",str); for(l=strlen(str);l>1;l--){ for(i=0;i<l-1;i++){ num=str[i]-'0'+str[i+1]-'0'; if(num>=10) num=num/10+num%10; str[i]=num+'0'; } } printf("%c\n",str[0]); }