結果
問題 | No.176 2種類の切手 |
ユーザー |
|
提出日時 | 2017-01-06 13:48:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 628 ms |
コンパイル使用メモリ | 68,632 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-17 19:58:55 |
合計ジャッジ時間 | 1,818 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <algorithm>#include <iostream>#include <list>#include <map>#include <numeric>#include <queue>#include <set>#include <sstream>#include <stack>#include <string>#include <utility>#include <vector>#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)using namespace std;typedef long long int ll;typedef vector<int> VI;typedef vector<ll> VL;typedef pair<int, int> PI;int main(void){ll a, b, t;cin >> a >> b >> t;ll mi = (t + a - 1) / a * a;for (ll x = 0; x < a * b && x < t + b; x += b) {ll rem = t - x;ll tmp = x;if (rem > 0) {tmp += (rem + a - 1) / a * a;}mi = min(mi, tmp);}cout << mi << endl;}