結果
問題 | No.176 2種類の切手 |
ユーザー |
![]() |
提出日時 | 2018-06-16 19:08:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 1,604 ms |
コンパイル使用メモリ | 166,876 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 16:24:36 |
合計ジャッジ時間 | 2,485 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 11 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=int(a);i<int(b);++i) using namespace std; typedef long long ll; ll INF = (1LL << 60) - 1; int MOD = 1e9+7; ll gcd (ll a,ll b){ return b ? gcd(b,a%b) : a; } main(){ ll A,B,T; cin >> A >> B >> T; ll ans = INF; int i; for(i = 0;i * i <= T && i * B <= T;i++){ ans = min(ans, (T - B * i + A - 1) / A * A + B * i); } if(B * i >= T)ans = min(ans, B * i); cout << ans << endl; }