結果

問題 No.178 美しいWhitespace (1)
ユーザー papinianuspapinianus
提出日時 2016-07-27 12:55:37
言語 PHP
(8.3.4)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 30,840 KB
実行使用メモリ 31,136 KB
最終ジャッジ日時 2024-04-24 10:20:05
合計ジャッジ時間 1,701 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
30,672 KB
testcase_01 AC 37 ms
30,896 KB
testcase_02 AC 38 ms
31,044 KB
testcase_03 AC 34 ms
30,968 KB
testcase_04 AC 35 ms
30,740 KB
testcase_05 AC 34 ms
30,684 KB
testcase_06 AC 34 ms
31,004 KB
testcase_07 AC 36 ms
30,880 KB
testcase_08 AC 34 ms
30,856 KB
testcase_09 AC 35 ms
30,840 KB
testcase_10 AC 36 ms
30,796 KB
testcase_11 AC 37 ms
30,692 KB
testcase_12 AC 36 ms
30,776 KB
testcase_13 AC 35 ms
30,892 KB
testcase_14 AC 39 ms
31,136 KB
testcase_15 AC 35 ms
31,004 KB
testcase_16 AC 34 ms
31,008 KB
testcase_17 AC 35 ms
30,892 KB
testcase_18 AC 36 ms
30,812 KB
testcase_19 AC 35 ms
30,764 KB
testcase_20 AC 37 ms
30,900 KB
testcase_21 AC 36 ms
30,884 KB
testcase_22 AC 34 ms
30,712 KB
testcase_23 AC 37 ms
30,832 KB
testcase_24 AC 35 ms
30,728 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$n = trim(fgets(STDIN));
$source = [];
for($i=0;$i<$n;$i++) {
    list($space, $tab) =  explode(" ", trim(fgets(STDIN)));
    $source[] = $space+4*$tab;
}
$width = max($source);
$ans = 0;
foreach($source as $line) {
    $rest = $width - $line;
    if($rest % 2) {
        $ans = -1;
        break;
    } else {
        $ans += $rest / 2;
    }
}
echo $ans;
echo PHP_EOL;
0