結果

問題 No.781 円周上の格子点の数え上げ
ユーザー face4face4
提出日時 2019-01-11 21:35:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 469 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 67,688 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-20 04:31:04
合計ジャッジ時間 4,416 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 7 ms
4,380 KB
testcase_11 AC 20 ms
4,376 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cmath>
using namespace std;

int main(){
    int x, y;
    cin >> x >> y;

    int ans = 0;
    for(int i = x; i <= y; i++){
        int point = 0;
        for(int j = 0; j*j <= i; j++){
            int tmp = sqrt(i-j*j);
            if(tmp*tmp + j*j == i){
                point += 4;
                if(tmp == 0 || j == 0)  point -= 2;
            }
        }
        ans = max(ans, point);
    }

    cout << ans << endl;

    return 0;
}
0