結果

問題 No.781 円周上の格子点の数え上げ
ユーザー face4
提出日時 2019-01-11 21:35:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 469 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 68,096 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-30 04:36:42
合計ジャッジ時間 10,402 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

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