結果

問題 No.781 円周上の格子点の数え上げ
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2019-02-23 17:48:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 157,940 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2024-05-07 18:37:03
合計ジャッジ時間 3,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
42,496 KB
testcase_01 AC 59 ms
42,348 KB
testcase_02 AC 58 ms
42,496 KB
testcase_03 AC 60 ms
42,588 KB
testcase_04 AC 63 ms
42,496 KB
testcase_05 AC 61 ms
42,496 KB
testcase_06 AC 61 ms
42,432 KB
testcase_07 AC 65 ms
42,500 KB
testcase_08 AC 60 ms
42,624 KB
testcase_09 AC 61 ms
42,492 KB
testcase_10 AC 61 ms
42,368 KB
testcase_11 AC 61 ms
42,496 KB
testcase_12 AC 64 ms
42,496 KB
testcase_13 AC 67 ms
42,496 KB
testcase_14 AC 60 ms
42,440 KB
testcase_15 AC 63 ms
42,488 KB
testcase_16 AC 59 ms
42,444 KB
testcase_17 AC 64 ms
42,368 KB
testcase_18 AC 63 ms
42,368 KB
testcase_19 AC 60 ms
42,368 KB
testcase_20 AC 60 ms
42,368 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