結果

問題 No.781 円周上の格子点の数え上げ
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2019-08-27 00:57:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 94,444 KB
実行使用メモリ 42,676 KB
最終ジャッジ日時 2023-08-08 14:08:16
合計ジャッジ時間 4,137 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
42,412 KB
testcase_01 AC 99 ms
42,404 KB
testcase_02 AC 99 ms
42,440 KB
testcase_03 AC 96 ms
42,444 KB
testcase_04 AC 102 ms
42,420 KB
testcase_05 AC 104 ms
42,460 KB
testcase_06 AC 101 ms
42,624 KB
testcase_07 AC 98 ms
42,440 KB
testcase_08 AC 97 ms
42,412 KB
testcase_09 AC 98 ms
42,560 KB
testcase_10 AC 97 ms
42,444 KB
testcase_11 AC 97 ms
42,424 KB
testcase_12 AC 104 ms
42,412 KB
testcase_13 AC 105 ms
42,444 KB
testcase_14 AC 101 ms
42,420 KB
testcase_15 AC 102 ms
42,436 KB
testcase_16 AC 101 ms
42,444 KB
testcase_17 AC 105 ms
42,448 KB
testcase_18 AC 100 ms
42,468 KB
testcase_19 AC 98 ms
42,676 KB
testcase_20 AC 98 ms
42,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


int A[10000001] = {0};

int main() {

    int X,Y;
    cin >> X >> Y;

    vector<int> V;

    for ( int i = 0; i < 10000; i++ ) {
        if ( i*i < 10000001 ) { V.push_back(i*i); }
    }
    
    for ( int i = 0; i < V.size(); i++ ) {
    for ( int j = 1; j < V.size(); j++ ) {
        if ( V[i]+V[j] < 10000001  ) { A[ V[i]+V[j] ]++; }
    }
    }

    int ans = 0;

    for ( int i = X; i <= Y; i++ ) {
        ans = max( ans, A[i]*4 );
    }

    cout << ans << endl;

    return 0;
}
0