結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー | startcpp |
提出日時 | 2017-05-17 12:16:15 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 270 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 1,154 ms |
コンパイル使用メモリ | 55,416 KB |
実行使用メモリ | 42,716 KB |
最終ジャッジ日時 | 2023-10-17 14:43:10 |
合計ジャッジ時間 | 3,235 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 258 ms
42,716 KB |
testcase_09 | AC | 262 ms
42,716 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 267 ms
42,716 KB |
testcase_13 | AC | 270 ms
42,716 KB |
testcase_14 | AC | 6 ms
6,372 KB |
testcase_15 | AC | 2 ms
4,348 KB |
testcase_16 | AC | 2 ms
4,348 KB |
testcase_17 | AC | 126 ms
26,852 KB |
testcase_18 | AC | 123 ms
26,852 KB |
testcase_19 | AC | 125 ms
28,900 KB |
testcase_20 | AC | 123 ms
28,900 KB |
ソースコード
#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; }