結果

問題 No.176 2種類の切手
ユーザー nebukuro09
提出日時 2016-11-25 09:24:48
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 114,176 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 05:13:40
合計ジャッジ時間 4,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 11 WA * 16 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;
import core.bitop;



void main() {
  auto input = readln.split.map!(to!int);
  auto A = input[0];
  auto B = input[1];
  auto T = input[2];
  if (T % A == 0 || T % B == 0) {writeln(T); return;}
  auto ans = int.max;
  foreach (i; 1..T/A+1) {
    auto j = (T - A*i - 1) / B + 1;
    ans = min(ans, A*i+B*j);
  }
  writeln(ans);
}
0