Last active
August 29, 2015 13:55
-
-
Save meki/8765229 to your computer and use it in GitHub Desktop.
AOJ_0001_PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hi = fopen('php://stdin', "r"); | |
$ho = fopen('php://stdout', "w"); | |
# 空の配列を作成 | |
$arr = array(); | |
# 標準入力からデータをセット | |
for($i = 0; $i < 10; $i++) | |
{ | |
fscanf($hi, "%d", $arr[]); | |
} | |
# 降順ソート | |
rsort($arr); | |
# 出力 | |
for($i = 0; $i < 3; $i++) | |
{ | |
fwrite($ho, sprintf("%d\n", $arr[$i])); | |
} | |
fclose($ho); | |
fclose($hi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment