結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー takimoto111takimoto111
提出日時 2018-04-20 18:39:06
言語 PHP
(8.3.4)
結果
AC  
実行時間 116 ms / 3,000 ms
コード長 306 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 18,604 KB
実行使用メモリ 48,228 KB
最終ジャッジ日時 2023-09-09 12:03:00
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,848 KB
testcase_01 AC 16 ms
18,676 KB
testcase_02 AC 16 ms
18,676 KB
testcase_03 AC 16 ms
18,768 KB
testcase_04 AC 16 ms
18,828 KB
testcase_05 AC 16 ms
18,828 KB
testcase_06 AC 15 ms
18,708 KB
testcase_07 AC 18 ms
18,784 KB
testcase_08 AC 28 ms
22,900 KB
testcase_09 AC 39 ms
27,000 KB
testcase_10 AC 101 ms
43,404 KB
testcase_11 AC 104 ms
42,668 KB
testcase_12 AC 105 ms
43,164 KB
testcase_13 AC 107 ms
45,388 KB
testcase_14 AC 106 ms
44,480 KB
testcase_15 AC 111 ms
45,600 KB
testcase_16 AC 116 ms
48,228 KB
testcase_17 AC 16 ms
18,744 KB
testcase_18 AC 16 ms
18,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php


// 標準入力を一行ずつ配列に代入します
while ($line = fgets(STDIN)) {
   $tmp[] = trim($line);
}

// 配列を展開
$i = 1;
$num = 0;
foreach ($tmp as $value){
 
 //1行目
 if ($i == 1){
// 1行目以外
 } else {
    
    $num += $value;
     
     
 }
 
 $i++;
}

echo $num;
0