結果
問題 | No.176 2種類の切手 |
ユーザー |
👑 |
提出日時 | 2023-05-01 21:38:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 1,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 75,996 KB |
最終ジャッジ日時 | 2025-02-12 16:25:07 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream>#include <set>using namespace std;int main(){int a,b,t;cin>>a>>b>>t;set<int> A;int i = 0;for(; t >= b*i; i++){if(A.count((t-b*i)%a))break;A.insert((t-b*i)%a);}int mn = ( b*i-t < 0 ? a : b*i-t);for(auto x: A){if(x == 0)mn = x;else mn = min(mn,a-x);}cout << mn+t << endl;}