結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-10-07 16:08:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,106 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 88,564 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-08 03:33:59 |
| 合計ジャッジ時間 | 1,673 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#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 pair<int, int> PI;
const double EPS=1e-9;
ll a, b, t;
ll f(ll v) {
ll res = a * v + max((t - a * v + b - 1) / b * b, 0LL);
cerr << "f(" << v<< ")=" << res << endl;
return res;
}
int main(void){
cin >> a >> b >> t;
if (a < b) { swap(a, b); }
ll x = 0, y = 1LL << 33;
while (y - x >= 10) {
ll z = (2 * x + y) / 3;
ll w = (x + 2 * y) / 3;
if (f(z) < f(w)) {
y = w;
} else {
x = z;
}
cerr << "x="<<x<<",y="<<y<<endl;
}
ll mi = f(x);
REP(i, x, y + 1) {
mi = min(mi, f(i));
}
cout << mi << endl;
}