結果

問題 No.3084 Identify f(x)
ユーザー The Forsaking
提出日時 2025-04-04 21:24:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 188,716 KB
実行使用メモリ 25,856 KB
平均クエリ数 3.00
最終ジャッジ日時 2025-04-04 21:24:07
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int ask(int)’:
main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |     scanf("%d", &x);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
typedef long long ll;
const int N = 2000086, MOD = 998244353, INF = 0x3f3f3f3f;
ll res;
int n, m, cnt, w[N], v1, v2;


int ask(int x) {
    printf("? %d\n", x);
    fflush(stdout);
    scanf("%d", &x);
    return x;
}

int main() {
    int b = ask(0);
    int a = ask(1) - b;
    printf("! %d %d\n", a, b);
    fflush(stdout);
    return 0;
}
0