結果

問題 No.1429 Simple Dowsing
ユーザー umezoumezo
提出日時 2021-03-14 14:08:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 199,156 KB
実行使用メモリ 24,360 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:01:04
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,532 KB
testcase_01 AC 25 ms
24,300 KB
testcase_02 AC 25 ms
24,360 KB
testcase_03 AC 25 ms
23,676 KB
testcase_04 AC 26 ms
23,388 KB
testcase_05 AC 26 ms
23,664 KB
testcase_06 AC 26 ms
24,012 KB
testcase_07 AC 25 ms
23,388 KB
testcase_08 AC 25 ms
24,048 KB
testcase_09 AC 25 ms
23,424 KB
testcase_10 AC 25 ms
24,324 KB
testcase_11 AC 26 ms
23,676 KB
testcase_12 AC 25 ms
23,352 KB
testcase_13 AC 25 ms
24,024 KB
testcase_14 AC 25 ms
24,012 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:21:23: 警告: ‘s’ may be used uninitialized [-Wmaybe-uninitialized]
   21 |   cout<<"! "<<r<<" "<<s<<endl;
      |                       ^
main.cpp:15:9: 備考: ‘s’ はここで定義されています
   15 |   int r,s;
      |         ^
main.cpp:21:18: 警告: ‘r’ may be used uninitialized [-Wmaybe-uninitialized]
   21 |   cout<<"! "<<r<<" "<<s<<endl;
      |                  ^~~
main.cpp:15:7: 備考: ‘r’ はここで定義されています
   15 |   int r,s;
      |       ^

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

#include<bits/stdc++.h>
using namespace std;

int main(){
  int d1,d2;
  cout<<"? 0 0"<<endl;
  cin>>d1;
  cout<<"? 100 0"<<endl;
  cin>>d2;
  
  int r,s;
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      if(i*i+j*j==d1 && (100-i)*(100-i)+j*j==d2) r=i,s=j;
    }
  }
  cout<<"! "<<r<<" "<<s<<endl;

  return 0;
}
0