結果

問題 No.176 2種類の切手
ユーザー koba-e964koba-e964
提出日時 2015-10-07 16:08:47
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,106 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 22:17:08
合計ジャッジ時間 1,544 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0