結果

問題 No.513 宝探し2
ユーザー kcz146kcz146
提出日時 2017-12-02 16:29:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 25,476 KB
平均クエリ数 3.00
最終ジャッジ日時 2024-07-17 01:33:09
合計ジャッジ時間 1,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
25,476 KB
testcase_01 AC 18 ms
24,836 KB
testcase_02 AC 18 ms
24,580 KB
testcase_03 AC 17 ms
24,580 KB
testcase_04 AC 18 ms
24,964 KB
testcase_05 AC 17 ms
24,836 KB
testcase_06 AC 18 ms
24,836 KB
testcase_07 AC 18 ms
25,220 KB
testcase_08 AC 19 ms
25,220 KB
testcase_09 AC 18 ms
25,476 KB
testcase_10 AC 18 ms
24,964 KB
testcase_11 AC 17 ms
24,580 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d", &d1);
      |     ~~~~~^~~~~~~~~~~
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d", &d2);
      |     ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include<cstdio>

int main(void) {
    int xx, yy;
    printf("0 0\n");
    fflush(stdout);
    int d1, d2;
    scanf("%d", &d1);
    // x + y = d1
    printf("100000 0\n");
    fflush(stdout);
    // 100000-x + y = d2
    scanf("%d", &d2);
    int x = (d1 - d2 + 100000)/2;
    int y = d1 - x;
    printf("%d %d\n", x, y);
    fflush(stdout);
}
0