結果

問題 No.176 2種類の切手
ユーザー kimiyuki
提出日時 2016-10-04 18:34:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 64,156 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 16:13:04
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 27 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:8:15: warning: overflow in conversion from 'll' {aka 'long long int'} to 'int' changes value from '1000000000000000009' to '-1486618615' [-Woverflow]
    8 |     int ans = inf;
      |               ^~~

ソースコード

diff #

#include <iostream>
typedef long long ll;
using namespace std;
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
const ll inf = ll(1e18)+9;
int main() {
    int a, b, t; cin >> a >> b >> t;
    int ans = inf;
    for (int i = 0; i <= t; i += b) {
        setmin(ans, i + (t - i + a-1)/a*a);
    }
    cout << ans << endl;
    return 0;
}
0