結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-06-08 16:50:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 697 bytes |
| コンパイル時間 | 949 ms |
| コンパイル使用メモリ | 64,328 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 03:10:10 |
| 合計ジャッジ時間 | 1,801 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)
typedef long long ll;
int gcd(int a, int b) {
return b == 0 ? a : gcd(b,a%b);
}
ll lcm(int a, int b) {
return (ll) a * b / gcd(a,b);
}
int main(void) {
int a, b, t;
cin >> a >> b >> t;
int ans = ((t-1) / b + 1) * b;
for (int n = t / lcm(a,b) * lcm(a,b); n < t; n += b)
ans = min(ans,((t-n-1) / a + 1) * a + n);
cout << ans << endl;
return 0;
}
h_noson