結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-03 00:55:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 57,576 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-08 02:52:16 |
| 合計ジャッジ時間 | 1,457 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
long long A, B, T;
void read() {
cin >> A >> B >> T;
}
void work() {
int bgnNB = (T + B - 1) / B;
int endNB = max(0LL, bgnNB - A);
long long minV = 1LL << 60;
for (int nB = bgnNB; nB >= endNB; --nB) {
int remainT = T - nB * B;
int nA = max(0LL, remainT + A - 1) / A;
minV = min(minV, nA * A + nB * B);
}
cout << minV << endl;
}
int main() {
read();
work();
return 0;
}