結果
問題 | No.176 2種類の切手 |
ユーザー |
|
提出日時 | 2016-11-25 09:47:40 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 261 ms / 1,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 1,003 ms |
コンパイル使用メモリ | 114,116 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 05:14:33 |
合計ジャッジ時間 | 2,438 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
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!long);auto A = input[0];auto B = input[1];auto T = input[2];if (T % A == 0 || T % B == 0) {writeln(T); return;}auto ans = long.max;foreach (i; 0..T/A+10) {auto j = T - A*i - 1 < 0 ? 0 : (T - A*i - 1) / B + 1;ans = min(ans, A*i+B*j);if (i > B) break;}writeln(ans);}