結果
| 問題 |
No.781 円周上の格子点の数え上げ
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-13 20:57:37 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 208 ms / 2,000 ms |
| コード長 | 663 bytes |
| コンパイル時間 | 1,956 ms |
| コンパイル使用メモリ | 73,828 KB |
| 実行使用メモリ | 82,232 KB |
| 最終ジャッジ日時 | 2024-10-06 06:23:32 |
| 合計ジャッジ時間 | 5,663 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int[] counts = new int[y + 1];
int max = 0;
for (int i = 0; i * i <= y; i++) {
int di = i * i;
for (int j = i; di + j * j <= y; j++) {
int dj = di + j * j;
if (dj < x) {
continue;
}
int by;
if (i == 0 || i == j) {
by = 1;
} else {
by = 2;
}
counts[dj] += by;
max = Math.max(max, counts[dj]);
}
}
System.out.println(max * 4);
}
}
htensai