結果

問題 No.781 円周上の格子点の数え上げ
コンテスト
ユーザー face4
提出日時 2019-01-11 21:35:02
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 469 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 470 ms
コンパイル使用メモリ 81,140 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2026-05-23 21:30:35
合計ジャッジ時間 4,346 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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