結果

問題 No.434 占い
ユーザー greentea011greentea011
提出日時 2018-10-15 10:13:29
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 495 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-20 20:23:37
合計ジャッジ時間 4,357 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
9,120 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 TLE -
testcase_09 AC 66 ms
6,940 KB
testcase_10 AC 6 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 TLE -
testcase_14 AC 65 ms
6,940 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#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'))/10+((s[i]-'0')+(s[i+1]-'0'))%10+'0';
   }
   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;
}
0