結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
しめはじめ
|
| 提出日時 | 2019-05-28 17:34:29 |
| 言語 | PHP (843.2) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 415 bytes |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 32,144 KB |
| 実行使用メモリ | 34,744 KB |
| 最終ジャッジ日時 | 2024-09-17 15:46:19 |
| 合計ジャッジ時間 | 2,914 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
$n = trim(fgets(STDIN));
$node = array();
for( $i = 1; $i <= $n; $i++ ){
$node[$i] = 0;
}
$ans = 0;
for( $i = 0; $i < ( $n - 1 ); $i++ ){
list( $a, $b ) = sscanf( trim(fgets(STDIN)), "%d %d" );
$node[$a]++;
$node[$b]++;
}
for( $i = 1; $i <= $n; $i++ ){
if ( $node[$i] > 2 ){
$ans += $node[$i] - 2;
}
}
print $ans."\n";
しめはじめ