結果

問題 No.176 2種類の切手
ユーザー 👑 CleyL
提出日時 2023-05-01 12:26:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 314 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 75,848 KB
最終ジャッジ日時 2025-02-12 16:16:20
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;
int main(){
  int a,b,t;cin>>a>>b>>t;
  set<int> A;
  for(int i = 0; t >= b*i; i++){
    if(A.count((t-b*i)%a))break;
    A.insert((t-b*i)%a);
  }
  int mn = a;
  for(auto x: A){
    if(x == 0)mn = x;
    else mn = min(mn,a-x);
  }
  cout << mn+t << endl;
}
0