結果
問題 | No.514 宝探し3 |
ユーザー |
![]() |
提出日時 | 2017-05-16 21:12:15 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,000 bytes |
コンパイル時間 | 3,252 ms |
コンパイル使用メモリ | 80,296 KB |
実行使用メモリ | 71,588 KB |
平均クエリ数 | 0.25 |
最終ジャッジ日時 | 2024-07-16 13:44:26 |
合計ジャッジ時間 | 8,173 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 1 TLE * 1 -- * 10 |
ソースコード
import java.util.*; public class Main { static ArrayList<Point> list = new ArrayList<>(); public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); System.out.println(0 + " " + 0); int d1 = scan.nextInt(); possiblePoints(d1); System.out.println(0 + " " + d1); int d2 = scan.nextInt(); serchPoint(d1, d2); } static void possiblePoints(int d) { for(int x=0; x<=d; x++) { int y = d-x; list.add(new Point(x,y)); } } static void serchPoint(int d1, int d2) { Point p1 = new Point(d1, 0); for(Point p2: list) { int d = Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y); if(d == d2) { System.out.println(p2.x + " " + p2.y); return; } } } } class Point { int x,y; Point(int x, int y) { this.x = x; this.y = y; } }