結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
![]() |
提出日時 | 2017-05-17 12:25:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 346 ms |
コンパイル使用メモリ | 55,720 KB |
実行使用メモリ | 42,552 KB |
最終ジャッジ日時 | 2024-09-17 12:29:24 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
//4倍高速化 #include <iostream> using namespace std; int cnt[10000001]; int X, Y; int main() { cin >> X >> Y; int maxR = 0; while (maxR * maxR <= Y) maxR++; maxR--; for (int x = 1; x <= maxR; x++) { for (int y = 0; y <= maxR; y++) { if (x * x + y * y <= Y) { cnt[x * x + y * y]++; } } } int ans = 0; for (int i = X; i <= Y; i++) { if (ans < cnt[i]) { ans = cnt[i]; } } cout << ans * 4 << endl; return 0; }