結果
| 問題 |
No.781 円周上の格子点の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-06 00:29:39 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 554 bytes |
| コンパイル時間 | 743 ms |
| コンパイル使用メモリ | 128,000 KB |
| 実行使用メモリ | 42,624 KB |
| 最終ジャッジ日時 | 2024-11-30 14:01:03 |
| 合計ジャッジ時間 | 1,832 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 1 |
ソースコード
#include <iostream>
#include <math.h>
constexpr int MAX_SIZE = 1e7+1;
int datum[MAX_SIZE] = {};
int main(void){
int x, y, max = 0;scanf("%d %d", &x, &y);
int i = 0, ii = 0, j, jj;
while((ii = i * i) <= y){
// ii * j * j >= x ~>
const int edge = x - ii;
j = floor(sqrt(x - ii));
while((jj = j * j) < edge) j++;
while((jj = j * j) <= y - ii){
datum[ii + jj] += (i == 0 or j == 0 or i == j) ? 2 : 4;
j++;
}
i++;
}
for(int i = x; i <= y; i++) if(max < datum[i]) max = datum[i];
printf("%d\n", max);
return 0;
}