結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-04-02 23:43:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 555 bytes |
| コンパイル時間 | 667 ms |
| コンパイル使用メモリ | 71,652 KB |
| 実行使用メモリ | 337,900 KB |
| 最終ジャッジ日時 | 2024-10-08 01:36:37 |
| 合計ジャッジ時間 | 3,195 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 WA * 3 TLE * 1 -- * 24 |
ソースコード
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
int main()
{
long long a, b, t;
while (cin>>a>>b>>t) {
if (a>b) swap(a, b);
if (a>=t) {
cout<<a<<endl;
continue;
}
auto res=1LL<<60;
auto x=b;
unordered_set<int> s;
while (true) {
auto m=(t-b)%a;
res=min(res, b+(t-b+a-1)/a*a);
if (s.count(m) or m==0) break;
s.insert(m);
b+=x;
}
cout<<res<<endl;
}
}
hogeover30