結果
問題 | No.2357 Guess the Function |
ユーザー |
|
提出日時 | 2023-06-23 22:44:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 61 ms / 1,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 4,094 ms |
コンパイル使用メモリ | 250,936 KB |
最終ジャッジ日時 | 2025-02-15 01:24:07 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
// #define _GLIBCXX_DEBUG#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using ll = long long;#define rep(i,n) for (ll i = 0; i < (n); ++i)using vl = vector<ll>;using vvl = vector<vl>;using P = pair<ll,ll>;#define pb push_back#define int long long#define double long double#define INF (ll) 3e18// Ctrl + Shift + B コンパイル// Ctrl + C 中断// ./m 実行signed main(){int a = -1;int b = -1;int x1 = 100;int x2 = -1;int y1 = -1;int y2 = -1;cout << "? " << x1 << endl;cin >> y1;if (y1 == 99) {cout << "! " << 99 << " " << 100 << endl; return 0;}x2 = x1 - y1-1;cout << "? " << x2 << endl;cin >> y2;b = y2 + 1;a = b-1 - (x2 % b);cout << "! " << a << " " << b << endl;}// (A + x) % B = y// (A + x) % B = y// A = 13 B = 97// x1 = 1000// 1013 % 97 = 43// x2 = 956// (956+13) % 97 = 96// a = b-1 - x2%b