結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー |
![]() |
提出日時 | 2019-02-06 21:03:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 255 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 2,046 ms |
コンパイル使用メモリ | 78,440 KB |
実行使用メモリ | 83,012 KB |
最終ジャッジ日時 | 2024-06-23 00:09:04 |
合計ジャッジ時間 | 6,005 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
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 = 1; 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); } }