結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
|
提出日時 | 2019-01-11 21:50:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 150 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 624 ms |
コンパイル使用メモリ | 68,692 KB |
実行使用メモリ | 42,496 KB |
最終ジャッジ日時 | 2024-11-30 05:48:00 |
合計ジャッジ時間 | 4,246 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include<iostream>#include<cmath>using namespace std;int memo[10000000] = {};int main(){int x, y;cin >> x >> y;int tmp = sqrt(10000000);for(int i = 0; i <= tmp; i++){for(int j = 0; j <= tmp; j++){if(i*i+j*j > 10000000) break;memo[i*i+j*j] += 4;if(i == 0 || j == 0) memo[i*i+j*j] -= 2;}}int ans = 0;for(int i = x; i <= y; i++){ans = max(ans, memo[i]);}cout << ans << endl;return 0;}