結果
問題 |
No.232 めぐるはめぐる (2)
|
ユーザー |
![]() |
提出日時 | 2015-08-03 02:20:21 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,316 bytes |
コンパイル時間 | 2,289 ms |
コンパイル使用メモリ | 77,464 KB |
実行使用メモリ | 60,196 KB |
最終ジャッジ日時 | 2024-07-18 00:54:50 |
合計ジャッジ時間 | 10,774 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 8 |
ソースコード
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int nowa = 0; int nowb = 0; int i; ArrayList<String> list = new ArrayList<String>(); for(i = 0; i < t-1; i++) { if(nowa == a-1 && nowb == b-1) break; StringBuilder sb = new StringBuilder(); if(nowa < a-1) { nowa++; sb.append("^"); } if(nowb < b-1) { nowb++; sb.append(">"); } list.add(sb.toString()); } if((nowa != a-1 && nowa != a) || (nowb != b-1 && nowb != b) ) { System.out.println("NO"); return; } System.out.println("YES"); for(int j = 0; j < list.size(); j++) { System.out.println(list.get(j)); } if(i == t-1) { StringBuilder sb = new StringBuilder(); if(nowa < a) { nowa++; sb.append("^"); } if(nowb < b) { nowb++; sb.append(">"); } System.out.println(sb.toString()); return; } i++; nowa++; System.out.println("^"); for(; i < t-1; i++) { if(nowa == a) { System.out.println("v>"); nowa = a-1; } else { System.out.println("^<"); nowa = a; } } if(nowa == a) { System.out.println(">"); } else { System.out.println("^"); } } }