結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
|
提出日時 | 2019-01-11 21:49:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 1,581 ms |
コンパイル使用メモリ | 166,296 KB |
実行使用メモリ | 81,664 KB |
最終ジャッジ日時 | 2024-11-30 05:43:54 |
合計ジャッジ時間 | 5,326 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXV = 10000000; ll cnt[MAXV + 1]; int main() { cin.tie(0); ios::sync_with_stdio(false); for (int i = 0; i * i <= MAXV; i++) { for (int j = 0; j <= i; j++) { int sum = i * i + j * j; if (sum > MAXV) break; int add = (1 + (i != 0)) * (1 + (j != 0)); if (i != j) add *= 2; cnt[sum] += add; } } int x, y; cin >> x >> y; ll ans = 0; for (int i = x; i <= y; i++) { ans = max(ans, cnt[i]); } cout << ans << endl; return 0; }