結果

問題 No.313 π
ユーザー Leonardone
提出日時 2015-12-07 01:17:30
言語 PHP
(843.2)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 547 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 30,692 KB
実行使用メモリ 31,376 KB
最終ジャッジ日時 2024-09-14 17:44:55
合計ジャッジ時間 3,177 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
/* yukicoder My Practice
 * author: Leonardone @ NEETSDKASU
 */

// 解説読後
// http://yukicoder.me/problems/686/editorial


$f = fgets(STDIN);

$c = strlen($f);

$a = [0,0,0,0,0, 0,0,0,0,0];

for ($i = 0; $i < $c; $i++) {
	if ($f[$i] === '.') {
		continue;
	}
	$a[intval($f[$i])]++;
}


$b = array(20105, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841);

$w = -1;
$c = -1;

for ($i = 0; $i < 10; $i++) {
	$d = $b[$i] - $a[$i];
	if ($d < 0) {
		$w = $i;
	} else if ($d > 0) {
		$c = $i;
	}
	
}

echo "{$w} {$c}", PHP_EOL;
0