結果

問題 No.604 誕生日のお小遣い
ユーザー motimoti
提出日時 2018-05-27 22:30:09
言語 Perl
(5.38.2)
結果
AC  
実行時間 62 ms / 1,000 ms
コード長 300 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-05-01 14:34:04
合計ジャッジ時間 2,588 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
12,672 KB
testcase_01 AC 62 ms
12,800 KB
testcase_02 AC 62 ms
12,672 KB
testcase_03 AC 60 ms
12,800 KB
testcase_04 AC 59 ms
12,672 KB
testcase_05 AC 59 ms
12,672 KB
testcase_06 AC 59 ms
12,800 KB
testcase_07 AC 59 ms
12,800 KB
testcase_08 AC 61 ms
12,800 KB
testcase_09 AC 60 ms
12,672 KB
testcase_10 AC 60 ms
12,544 KB
testcase_11 AC 60 ms
12,672 KB
testcase_12 AC 61 ms
12,672 KB
testcase_13 AC 61 ms
12,672 KB
testcase_14 AC 62 ms
12,800 KB
testcase_15 AC 62 ms
12,672 KB
testcase_16 AC 61 ms
12,800 KB
testcase_17 AC 60 ms
12,800 KB
testcase_18 AC 61 ms
12,800 KB
testcase_19 AC 61 ms
12,672 KB
testcase_20 AC 60 ms
12,800 KB
testcase_21 AC 60 ms
12,800 KB
testcase_22 AC 60 ms
12,672 KB
testcase_23 AC 62 ms
12,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use bigint;

my ($x, $y, $z) = split/ /, <>;
chomp $z;

my ($l, $r) = (0, 1000000000000000000);
while ($l + 1 < $r) {
  my $m = ($l + $r) / 2;
  my $ca = $m / $x;
  my $rz = $ca * $y + ($m - $ca);
  if ($z <= $rz) {
    $r = $m;
  } else {
    $l = $m;
  }
}

print "$r\n";
0