結果

問題 No.176 2種類の切手
ユーザー GoryudyumaGoryudyuma
提出日時 2015-04-03 21:04:35
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 1,183 ms
コンパイル使用メモリ 31,112 KB
実行使用メモリ 36,504 KB
最終ジャッジ日時 2024-04-16 22:03:29
合計ジャッジ時間 4,335 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
36,504 KB
testcase_01 AC 37 ms
31,044 KB
testcase_02 AC 35 ms
31,416 KB
testcase_03 AC 36 ms
31,228 KB
testcase_04 AC 35 ms
31,300 KB
testcase_05 AC 37 ms
31,152 KB
testcase_06 AC 35 ms
31,168 KB
testcase_07 AC 35 ms
31,248 KB
testcase_08 AC 39 ms
31,340 KB
testcase_09 AC 37 ms
31,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 36 ms
31,528 KB
testcase_13 AC 38 ms
31,296 KB
testcase_14 AC 36 ms
31,204 KB
testcase_15 AC 37 ms
30,932 KB
testcase_16 AC 34 ms
31,092 KB
testcase_17 WA -
testcase_18 AC 35 ms
31,344 KB
testcase_19 AC 39 ms
31,264 KB
testcase_20 AC 38 ms
31,220 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$a= explode(' ',(trim(fgets(STDIN))));

foreach ($a as $f) {
    $f=intval($f);
}

list($a[0],$a[1])=array(min($a[0],$a[1]),max($a[0],$a[1]));

$b=(int)($a[2]/$a[1])+1;

$ans=PHP_INT_MAX;

for($i=0;$i<=$b;$i++){
    $c=$a[2]-$i*$a[1];
    if($c<0){
        break;
    }
    $d=(int)($c/$a[0]);
    $e=$i*$a[1]+$d*$a[0];
    if($e<$a[2]){
        $e+=$a[0];
    }
    $ans=min($ans,$e);
}

echo ($ans).PHP_EOL;
0