結果

問題 No.3498 Modulo Equation
コンテスト
ユーザー tkms
提出日時 2026-04-18 17:06:52
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 950 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,840 ms
コンパイル使用メモリ 246,164 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-18 17:07:09
合計ジャッジ時間 6,183 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// @yuuzaa_tkms
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define Ye cout<<"Yes"<<endl
#define YE cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vec vector
using namespace std;
using ll=long long;
using ull=unsigned long long;
using namespace atcoder;
using mint=modint998244353;
vector<int>dx={0,1,0,-1,-1,-1,1,1};
vector<int>dy={1,0,-1,0,-1,1,-1,1};
int INF=1e9;
ull LINF=1e18;
bool edge(int x,int y,int H,int W){
    if(x<0||x>=H||y<0||y>=W)return 0;
    else return 1;
}
//実装は丁寧に書こう
//1400復帰しよう!
int main(){
    int A,B;
    cin>>A>>B;
    rep(i,1000000){
        if(i==0)continue;
        if(i%A==B%i){
            cout<<i<<endl;
            exit(0);
        }
    }
}
0