結果
| 問題 |
No.781 円周上の格子点の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-15 19:36:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 382 bytes |
| コンパイル時間 | 1,372 ms |
| コンパイル使用メモリ | 166,556 KB |
| 実行使用メモリ | 42,676 KB |
| 最終ジャッジ日時 | 2024-07-06 22:48:24 |
| 合計ジャッジ時間 | 2,374 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int cnt[(int)1e7+1];
int main() {
int x, y;
cin>>x>>y;
for (int i=0; i<=y; i++) cnt[i] = 0;
for (int i=0; i<=sqrt(y); i++) {
for (int j=1; j<=sqrt(y); j++) {
if (i*i + j*j > y) break;
++cnt[i*i + j*j];
}
}
int ans = 0;
for (int i=x; i<=y; i++) {
ans = max(cnt[i], ans);
}
cout<<4*ans<<endl;
}