結果

問題 No.3498 Modulo Equation
コンテスト
ユーザー tiga
提出日時 2026-04-18 14:20:30
言語 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
コード長 1,755 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,283 ms
コンパイル使用メモリ 547,412 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-18 14:20:45
合計ジャッジ時間 8,990 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <utility>
#include <stack>
#include <iomanip>
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace atcoder;
using namespace boost::multiprecision;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using mint = modint998244353;
#define int long long
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
const ll INF = 1e18;
const int dx[8] = {0, 1, 0, -1, -1, -1, 1, 1};
const int dy[8] = {1, 0, -1, 0, -1, 1, -1, 1};
template <typename T>
inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template <typename T>
inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
void yn(bool t) { cout << (t ? "Yes" : "No") << endl; }
uint64_t seed = chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count();
mt19937_64 rng(seed);
int randint(int l, int r)
{
  return uniform_int_distribution<int>(l, r)(rng);
}

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

signed main()
{
#ifdef INPUT_FILE_PATH
  freopen(INPUT_FILE_PATH, "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}
0