結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー hamhamhamham
提出日時 2017-06-13 13:51:17
言語 PHP
(8.3.4)
結果
AC  
実行時間 99 ms / 3,000 ms
コード長 280 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 12,312 KB
最終ジャッジ日時 2023-08-26 17:08:35
合計ジャッジ時間 1,954 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
12,208 KB
testcase_01 AC 6 ms
12,188 KB
testcase_02 AC 6 ms
12,272 KB
testcase_03 AC 6 ms
12,260 KB
testcase_04 AC 6 ms
12,212 KB
testcase_05 AC 6 ms
12,300 KB
testcase_06 AC 6 ms
12,248 KB
testcase_07 AC 9 ms
12,244 KB
testcase_08 AC 16 ms
12,204 KB
testcase_09 AC 26 ms
12,260 KB
testcase_10 AC 83 ms
12,312 KB
testcase_11 AC 83 ms
12,232 KB
testcase_12 AC 86 ms
12,312 KB
testcase_13 AC 88 ms
12,228 KB
testcase_14 AC 88 ms
12,208 KB
testcase_15 AC 90 ms
12,260 KB
testcase_16 AC 99 ms
12,264 KB
testcase_17 AC 6 ms
12,268 KB
testcase_18 AC 6 ms
12,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
//1行目を読み込む
$line1 = trim(fgets(STDIN));
//2行目以降を読み込む
$sum = 0;
for($i = 1; $i <= $line1; $i++) {
    $line_n = trim(fgets(STDIN));
    if($line_n === null || $line_n === "" ) {
        break;
    }
    $sum += $line_n;
}

printf("{$sum}\n");
0