結果

問題 No.781 円周上の格子点の数え上げ
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2019-08-27 00:57:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 96,972 KB
実行使用メモリ 42,844 KB
最終ジャッジ日時 2024-04-26 06:51:42
合計ジャッジ時間 3,442 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
42,648 KB
testcase_01 AC 87 ms
42,600 KB
testcase_02 AC 80 ms
42,536 KB
testcase_03 AC 85 ms
42,672 KB
testcase_04 AC 78 ms
42,584 KB
testcase_05 AC 80 ms
42,680 KB
testcase_06 AC 81 ms
42,616 KB
testcase_07 AC 81 ms
42,520 KB
testcase_08 AC 84 ms
42,668 KB
testcase_09 AC 79 ms
42,500 KB
testcase_10 AC 78 ms
42,384 KB
testcase_11 AC 76 ms
42,516 KB
testcase_12 AC 83 ms
42,504 KB
testcase_13 AC 87 ms
42,720 KB
testcase_14 AC 74 ms
42,580 KB
testcase_15 AC 75 ms
42,700 KB
testcase_16 AC 78 ms
42,720 KB
testcase_17 AC 91 ms
42,844 KB
testcase_18 AC 78 ms
42,552 KB
testcase_19 AC 86 ms
42,660 KB
testcase_20 AC 82 ms
42,540 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