結果

問題 No.781 円周上の格子点の数え上げ
ユーザー srjywrdnprkt
提出日時 2024-02-09 18:26:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 453 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 1,870 ms
コンパイル使用メモリ 195,448 KB
最終ジャッジ日時 2025-02-19 03:03:47
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll x, y, m=1e7, ans=0;
    cin >> x >> y;
    m = sqrt(m)+1;
    vector<ll> cnt(3e7);
    for (int i=-m; i<=m; ++i){
        for (int j=-m; j<=m; ++j) cnt[i*i+j*j]++;
    }

    for (int i=x; i<=y; i++) ans = max(ans, cnt[i]);

    cout << ans << endl;

    return 0;
}
0