結果

問題 No.781 円周上の格子点の数え上げ
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2019-08-27 01:38:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 747 ms
コンパイル使用メモリ 94,024 KB
実行使用メモリ 42,780 KB
最終ジャッジ日時 2024-04-26 10:01:39
合計ジャッジ時間 3,589 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
42,472 KB
testcase_01 AC 86 ms
42,508 KB
testcase_02 AC 87 ms
42,480 KB
testcase_03 AC 86 ms
42,616 KB
testcase_04 AC 89 ms
42,608 KB
testcase_05 AC 90 ms
42,640 KB
testcase_06 AC 85 ms
42,716 KB
testcase_07 AC 88 ms
42,600 KB
testcase_08 AC 86 ms
42,744 KB
testcase_09 AC 89 ms
42,624 KB
testcase_10 AC 87 ms
42,508 KB
testcase_11 AC 86 ms
42,780 KB
testcase_12 AC 94 ms
42,488 KB
testcase_13 AC 98 ms
42,672 KB
testcase_14 AC 92 ms
42,480 KB
testcase_15 AC 84 ms
42,516 KB
testcase_16 AC 87 ms
42,660 KB
testcase_17 AC 88 ms
42,520 KB
testcase_18 AC 86 ms
42,640 KB
testcase_19 AC 86 ms
42,720 KB
testcase_20 AC 84 ms
42,676 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[(int)1e7] = {0};

int main() {

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

    for ( int i = 0; i <= sqrt(1e7); i++ ) {
    for ( int j = 1; j <= sqrt(1e7); j++ ) {
        if ( i*i + j*j > 1e7 ) { break; }
        A[ i*i + j*j ]++;
    }
    }

    int ans = 0;

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

    cout << ans << endl;

    return 0;
}
0