結果
問題 |
No.434 占い
|
ユーザー |
![]() |
提出日時 | 2018-10-15 10:43:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 23,680 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-10-12 18:28:16 |
合計ジャッジ時間 | 4,128 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 TLE * 1 -- * 15 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d", &t); | ~~~~~^~~~~~~~~~ main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%s", s); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> char s[10000001]; char f(int cnt) { if (cnt==1) return s[0]; for (int i=0;i<cnt-1;i++) { s[i]=((s[i]-'0')+(s[i+1]-'0'))%9+'0'; if (s[i]=='0') s[i]='9'; } s[cnt-1] = '\0'; return f(cnt-1); } int main() { int t; char ans[1000000]; scanf("%d", &t); for (int i=0; i<t; i++) { scanf("%s", s); ans[i]=f(strlen(s)); } for (int i=0; i<t; i++) { printf("%c\n", ans[i]); } return 0; }