結果

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

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a-1; i >= b; i--)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vvvll> vvvvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<bool> vb;
typedef vector<vd> vvb;
typedef vector<vvd> vvvb;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef tuple<int, int, int> tui3;
typedef tuple<ll, ll, ll> tull3;
typedef priority_queue<int, vector<int>, greater<int>> pqi;
typedef priority_queue<vi, vector<vi>, greater<vi>> pqvi;
typedef priority_queue<pi, vector<pi>, greater<pi>> pqpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqll;
typedef priority_queue<vll, vector<vll>, greater<vll>> pqvll;
typedef priority_queue<pll, vector<pll>, greater<pll>> pqpll;
typedef priority_queue<pll, vector<pll>, less<pll>> rpqpll;
typedef priority_queue<int, vector<int>, less<int>> rpqi;
typedef priority_queue<vi, vector<vi>, less<vi>> rpqvi;
typedef priority_queue<tui3, vector<tui3>, greater<tui3>> pqtui3;
typedef priority_queue<tui3, vector<tui3>, less<tui3>> rpqtui3;
typedef priority_queue<tull3, vector<tull3>, greater<tull3>> pqtull3;
typedef priority_queue<tull3, vector<tull3>, less<tull3>> rpqtull3;
#define yes(ans) if(ans)cout << "yes"<< endl; else cout << "no" << endl
#define Yes(ans) if(ans)cout << "Yes"<< endl; else cout << "No" << endl
#define YES(ans) if(ans)cout << "YES"<< endl ;else cout << "NO" << endl
#define pos(ans) if(ans)cout << "Possible"<< endl ;else cout << "Impossible" << endl
#define printv(vec) {rep(i, 0, vec.size()) cout << vec[i] << ' '; cout << endl;}
#define printvv(vec) rep(i, 0, vec.size()) {rep(j, 0, vec[i].size()) cout << vec[i][j] << ' '; cout << endl;};
#define printvvv(vec) rep(i, 0, vec.size()) { rep(j, 0, vec[i].size()) { rep(k, 0, vec[i][j].size()) cout << vec[i][j][k] << ' '; cout << "	"; }cout << endl; };
#define all(x) x.begin(), x.end()
#define so(x) sort(all(x))
#define re(x) reverse(all(x))
#define rso(x) sort(x.rbegin(), x.rend())
#define vco(x, a) count(all(x), a)
#define per(x) next_permutation(all(x))
#define out(x) cout << x << endl
#define iINF 2147483647
#define llINF 9223372036854775807
#define INF 4000000000000000000
#define mod 998244353
#define mod2 1000000007
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}

int main() {
    int a, b; cin >> a >> b;
    rep(i, 1, 1000000){
        if(i%a==b%i){
            cout << i << endl;
            return 0;
        }
    }
}
0