結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
![]() |
提出日時 | 2017-05-17 12:16:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 55,220 KB |
実行使用メモリ | 42,456 KB |
最終ジャッジ日時 | 2024-09-17 12:29:16 |
合計ジャッジ時間 | 2,414 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#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 = -maxR; x <= maxR; x++) { for (int y = -maxR; 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 << endl; return 0; }