結果

問題 No.176 2種類の切手
ユーザー ShibuyapShibuyap
提出日時 2020-01-29 17:41:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,126 bytes
コンパイル時間 1,444 ms
コンパイル使用メモリ 164,432 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-14 06:30:44
合計ジャッジ時間 3,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll a, b, t;
    cin >> a >> b >> t;

    ll ans = 12345678912345;

    if(b >= 1000){
        int i = 0;
        while(true){
            ll tmp = t - b * i;
            if(tmp <= 0){
                ans = min(ans, b * i);
                break;
            }
            ll cnt = (tmp - 1) / a + 1;
            ans = min(ans, b * i + a * cnt);
            i++;
        }
    }else{
        ll ans2 = t / (a * b) * (a * b);
        t %= (a * b);
        int i = 0;
        while(true){
            ll tmp = t - b * i;
            if(tmp <= 0){
                ans = min(ans, b * i + ans2);
                break;
            }
            ll cnt = (tmp - 1) / a + 1;
            ans = min(ans, ans2 + b * i + a * cnt);
            i++;
        }
    }
    

    cout << ans << endl;
    return 0;
}
 
 
0