結果
| 問題 |
No.434 占い
|
| コンテスト | |
| ユーザー |
greentea011
|
| 提出日時 | 2018-10-15 10:25:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 23,296 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-12 18:28:00 |
| 合計ジャッジ時間 | 9,682 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 TLE * 3 -- * 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[1000000];
char f() {
if (strlen(s)==1) return s[0];
for (int i=0;i<strlen(s)-1;i++) {
s[i]=((s[i]-'0')+(s[i+1]-'0'))%9+'0';
if (s[i]=='0') s[i]='9';
}
s[strlen(s)-1] = '\0';
return f();
}
int main() {
int t;
char ans[1000000];
scanf("%d", &t);
for (int i=0; i<t; i++) {
scanf("%s", s);
ans[i]=f();
}
for (int i=0; i<t; i++) {
printf("%c\n", ans[i]);
}
return 0;
}
greentea011