結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-06 22:35:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 1,000 ms |
| コード長 | 781 bytes |
| コンパイル時間 | 963 ms |
| コンパイル使用メモリ | 89,576 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-08 03:10:50 |
| 合計ジャッジ時間 | 2,299 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
int main()
{
long long a, b, t;
cin >> a >> b >> t;
long long ans = INT_MAX;
for(int i=0; i<2; ++i){
for(int j=0; j<100000; ++j){
long long x = a * j;
long long y = max(0LL, t - x);
long long cost = x + (y + b - 1) / b * b;
ans = min(ans, cost);
}
swap(a, b);
}
cout << ans << endl;
return 0;
}