結果

問題 No.781 円周上の格子点の数え上げ
ユーザー @abcde@abcde
提出日時 2019-02-02 22:29:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 711 bytes
コンパイル時間 2,905 ms
コンパイル使用メモリ 152,644 KB
実行使用メモリ 100,448 KB
最終ジャッジ日時 2023-08-19 20:11:59
合計ジャッジ時間 8,637 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int LIMIT = 1e7;

int main() {
    
    // 1. 入力情報取得.
    int A, B;
    cin >> A >> B;
    
    // 2. f(R) の 最大値 を 計算.
    // TLE防止のため, 事前に, 半径R の 候補 を保存.
    map<int, int> m;
    for(int x = 0; x < sqrt(LIMIT) + 1; x++) m[x * x + 0 * 0]++;
    for(int x = 1; x < sqrt(LIMIT) + 1; x++){
        for(int y = 1; y < sqrt(LIMIT) + 1; y++){
            m[x * x + y * y]++;
        }
    }
    // for(auto &p : m) cout << p.first << " " << p.second << endl;
    int ans = 0;
    for(int r = A; r <= B; r++) ans = max(ans, m[r]);
    
    // 3. 後処理.
    cout << (ans * 4) << endl;
    return 0;
    
}
0