結果

問題 No.781 円周上の格子点の数え上げ
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2019-02-23 17:48:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 143,524 KB
実行使用メモリ 42,692 KB
最終ジャッジ日時 2023-08-20 11:53:33
合計ジャッジ時間 4,338 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
42,400 KB
testcase_01 AC 78 ms
42,456 KB
testcase_02 AC 78 ms
42,412 KB
testcase_03 AC 78 ms
42,412 KB
testcase_04 AC 78 ms
42,560 KB
testcase_05 AC 78 ms
42,388 KB
testcase_06 AC 79 ms
42,404 KB
testcase_07 AC 79 ms
42,496 KB
testcase_08 AC 79 ms
42,456 KB
testcase_09 AC 77 ms
42,396 KB
testcase_10 AC 78 ms
42,388 KB
testcase_11 AC 79 ms
42,476 KB
testcase_12 AC 81 ms
42,404 KB
testcase_13 AC 87 ms
42,452 KB
testcase_14 AC 77 ms
42,544 KB
testcase_15 AC 77 ms
42,628 KB
testcase_16 AC 79 ms
42,408 KB
testcase_17 AC 84 ms
42,692 KB
testcase_18 AC 80 ms
42,392 KB
testcase_19 AC 78 ms
42,588 KB
testcase_20 AC 79 ms
42,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int mem[10000001];
int main(){
    int x,y,res=0;
    cin >> x >> y;
    for(int i=0;i<10000001;i++)mem[i] = 0;
    for(int i=0;i<4001;i++)for(int j=i+1;j<4001;j++){
        if(i*i+j*j <= 10000001){
            if(i == 0 || j == i)
                mem[i*i+j*j] += 4;
            else
                mem[i*i+j*j] += 8;
            
        }
    }
    for(int i=0;i<4001;i++)if(i*i*2 <= 10000001)mem[i*i*2] += 4;
    for(int i=x;i<=y;i++)res = max(res,mem[i]);
    cout << res << endl;
    return 0;
}
0