結果

問題 No.781 円周上の格子点の数え上げ
ユーザー titiatitia
提出日時 2019-01-11 22:58:30
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 658 bytes
コンパイル時間 2,582 ms
使用メモリ 42,216 KB
最終ジャッジ日時 2023-01-06 18:12:15
合計ジャッジ時間 5,436 ms
ジャッジサーバーID
(参考情報)
judge10 / judge16
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 89 ms
42,180 KB
testcase_01 AC 90 ms
42,156 KB
testcase_02 AC 94 ms
42,208 KB
testcase_03 AC 89 ms
42,116 KB
testcase_04 AC 91 ms
42,216 KB
testcase_05 AC 91 ms
42,116 KB
testcase_06 AC 92 ms
42,176 KB
testcase_07 AC 90 ms
42,096 KB
testcase_08 AC 92 ms
42,116 KB
testcase_09 AC 88 ms
42,044 KB
testcase_10 AC 90 ms
42,204 KB
testcase_11 AC 90 ms
42,048 KB
testcase_12 AC 95 ms
42,116 KB
testcase_13 AC 102 ms
42,104 KB
testcase_14 AC 89 ms
42,112 KB
testcase_15 AC 89 ms
42,048 KB
testcase_16 AC 90 ms
42,176 KB
testcase_17 AC 99 ms
42,108 KB
testcase_18 AC 91 ms
42,044 KB
testcase_19 AC 92 ms
42,116 KB
testcase_20 AC 91 ms
42,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int X,Y;
  cin >> X>>Y;
  int N=10000000;

  int u=3162;
  vector<int> LIST(N+1);

  for (int i=1;i<u+1;i++){
    LIST.at(i*i)+=4;
  }

  for (int i=1;i<u+1;i++){
    for (int j=i;j<u+1;j++){
        if (i*i+j*j<=10000000){
            if (i!=j){
                LIST.at(i*i+j*j)+=8;
            }else
            {
                LIST.at(i*i+j*j)+=4;
            }

        }
    }
  }

  int ANS=0;
  for (int i=X;i<Y+1;i++){
    if (LIST.at(i)>ANS){
        ANS=LIST.at(i);
    }
  }

  //cout<<u <<endl;
  //cout<<X <<Y <<N <<endl;
  cout<<ANS<<endl;
}
0