結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 16 ms
18,708 KB
testcase_03 AC 16 ms
18,860 KB
testcase_04 AC 15 ms
18,788 KB
testcase_05 AC 15 ms
18,840 KB
testcase_06 AC 16 ms
18,776 KB
testcase_07 AC 15 ms
18,788 KB
testcase_08 AC 16 ms
18,808 KB
testcase_09 AC 16 ms
18,752 KB
testcase_10 AC 16 ms
18,716 KB
testcase_11 AC 16 ms
18,836 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 15 ms
18,832 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 15 ms
18,760 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 ."\n");
0