結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
|
提出日時 | 2019-01-12 02:54:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 3,026 ms |
コンパイル使用メモリ | 166,368 KB |
実行使用メモリ | 43,552 KB |
最終ジャッジ日時 | 2024-12-14 14:08:45 |
合計ジャッジ時間 | 3,290 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int p[123456789]; int main() { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x >> y; int a = 1; while((a + 1) * (a + 1) <= y) { a++; } for(int i = 1; i <= a; i++) { for(int j = 0; j <= a; j++) { if(i * i + j * j > y) continue; p[i * i + j * j]++; } } int ans = 0; for(int i = x; i <= y; i++) { ans = max(ans, p[i]); } cout << ans * 4 << endl; return 0; }