結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
![]() |
提出日時 | 2019-02-06 20:51:39 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 664 bytes |
コンパイル時間 | 3,097 ms |
コンパイル使用メモリ | 78,624 KB |
実行使用メモリ | 82,424 KB |
最終ジャッジ日時 | 2024-06-22 23:06:16 |
合計ジャッジ時間 | 7,811 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 3 |
ソースコード
import java.util.Scanner; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int X = stdin.nextInt(); int Y = stdin.nextInt(); int[] counts = new int[Y + 1]; for (int x = 0; x * x <= Y; x++) { for (int y = 0; y * y <= Y; y++) { int z = x * x + y * y; if (z <= Y) { counts[z] += 1; } } } int ans = IntStream.rangeClosed(X, Y).map(i -> counts[i]).max().getAsInt(); System.out.println(ans * 4); } }