結果
| 問題 | 
                            No.513 宝探し2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lunnear
                         | 
                    
| 提出日時 | 2019-02-18 05:48:46 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 25 ms / 2,000 ms | 
| コード長 | 507 bytes | 
| コンパイル時間 | 156 ms | 
| コンパイル使用メモリ | 24,576 KB | 
| 実行使用メモリ | 25,220 KB | 
| 平均クエリ数 | 2.75 | 
| 最終ジャッジ日時 | 2024-07-17 02:07:22 | 
| 合計ジャッジ時間 | 1,420 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 | 
コンパイルメッセージ
main.cpp: In function ‘s4 q(s4, s4)’:
main.cpp:8:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘s4’ {aka ‘long int’} [-Wformat=]
    8 |     printf("%d %d\n", x, y);
      |             ~^        ~
      |              |        |
      |              int      s4 {aka long int}
      |             %ld
main.cpp:8:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘s4’ {aka ‘long int’} [-Wformat=]
    8 |     printf("%d %d\n", x, y);
      |                ~^        ~
      |                 |        |
      |                 int      s4 {aka long int}
      |                %ld
main.cpp:12:13: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘s4*’ {aka ‘long int*’} [-Wformat=]
   12 |     scanf("%d", &ret);
      |            ~^   ~~~~
      |             |   |
      |             |   s4* {aka long int*}
      |             int*
      |            %ld
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d", &ret);
      |     ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <stdlib.h>
typedef long s4;
s4 q(s4 x, s4 y)
{
    printf("%d %d\n", x, y);
    fflush(0);
    
    s4 ret;
    scanf("%d", &ret);
    
    return ret;
}
int main()
{
    const s4 MAX = 100000;
    s4 d[2];
    
    d[0] = q(0, 0);
    if(d[0] == 0)
        return 0;
    
    d[1] = q(MAX, 0);
    if(d[1] == 0)
        return 0;
    
    
    s4 x, y;
    x = d[0] - (MAX - d[1]);
    x = (MAX - d[1]) + x / 2;
    y = abs(d[0] - x);
    
    q(x, y);
    
    return 0;
}
            
            
            
        
            
lunnear