結果
| 問題 | No.781 円周上の格子点の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-17 17:26:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 1,663 ms |
| コンパイル使用メモリ | 168,044 KB |
| 実行使用メモリ | 81,408 KB |
| 最終ジャッジ日時 | 2024-10-03 10:27:43 |
| 合計ジャッジ時間 | 3,503 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
int X, Y;
cin >> X >> Y;
int upper = sqrt(Y)+1;
int c;
vector<int> r(2*Y+1);
rep(a, upper){
for (int b=a; b < upper; b++){
c = a*a+b*b;
if (a==0 || a==b) {
r[c] += 4;
}
else{
r[c] += 8;
}
}
}
int ans = 0;
for (int x=X;x<Y+1;x++) {
ans = max(ans, r[x]);
}
cout << ans << endl;
}