結果

問題 No.1168 Digit Sum Sequence
ユーザー hiramarihiramari
提出日時 2020-12-02 01:10:40
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 18,668 KB
実行使用メモリ 19,064 KB
最終ジャッジ日時 2023-10-11 04:13:40
合計ジャッジ時間 1,816 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 16 ms
18,876 KB
testcase_03 AC 16 ms
18,868 KB
testcase_04 AC 15 ms
18,888 KB
testcase_05 AC 16 ms
18,928 KB
testcase_06 AC 16 ms
18,868 KB
testcase_07 AC 16 ms
18,896 KB
testcase_08 AC 16 ms
18,868 KB
testcase_09 AC 16 ms
18,892 KB
testcase_10 AC 15 ms
18,920 KB
testcase_11 AC 16 ms
18,936 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 16 ms
18,864 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 16 ms
18,956 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    list($N) = explode(" ", trim(fgets(STDIN)));
    $ans = 0;
    $sum = str_split($N);
    for($i=0;$i<100;$i++){
        for($j=0;$j<count($sum);$j++){
            $ans += intval($sum[$j]);
        }
        if(count(str_split($ans)) <= 1){
            break;
        }else{
           $sum = str_split($ans); 
        }
    }
    printf($ans);
0