結果
| 問題 | No.781 円周上の格子点の数え上げ | 
| コンテスト | |
| ユーザー |  merom686 | 
| 提出日時 | 2019-01-11 22:29:02 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 86 ms / 2,000 ms | 
| コード長 | 1,179 bytes | 
| コンパイル時間 | 853 ms | 
| コンパイル使用メモリ | 74,360 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-30 13:18:27 | 
| 合計ジャッジ時間 | 1,824 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 21 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int main() {
    int x, y;
    cin >> x >> y;
    int p[100] = { 72,96,96,96,96,96,96,96,128,96,128,128,108,128,128,96,128,128,96,128,144,128,128,128,128,128,144,144,128,144,128,128,128,128,144,128,128,128,144,128,160,144,128,144,128,144,144,128,128,144,144,160,144,144,144,128,160,144,144,192,128,144,128,144,144,192,128,128,144,144,144,128,144,160,144,144,144,144,144,128,160,144,144,192,192,144,128,160,128,144,144,144,144,128,144,144,160,192,144,144, };
    
    int m = 0;
    for (int r = x; r <= y; r++) {
        if (r % 100000 == 1) {
            for (int i = r / 100000; i < y / 100000; i++) {
                m = max(m, p[i]);
            }
            r = y / 100000 * 100000 + 1;
        }
        int b = 0, c = 0;
        for (int a = (int)sqrt(r); b = (int)sqrt(r - a * a), a >= b; a--) {
            if (a * a + b * b == r) {
                c++;
                if (a > b && b != 0) c++;
            }
        }
        m = max(m, c * 4);
    }
    cout << m << endl;
    return 0;
}
            
            
            
        