結果

問題 No.232 めぐるはめぐる (2)
ユーザー Grenache
提出日時 2015-06-27 00:19:44
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,337 bytes
コンパイル時間 3,084 ms
コンパイル使用メモリ 77,540 KB
実行使用メモリ 43,832 KB
最終ジャッジ日時 2024-07-07 19:36:18
合計ジャッジ時間 7,766 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Scanner;


public class Main_yukicoder232 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int t = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int len = Math.min(a, b) + Math.abs(a - b);
        int x = 0;
        int y = 0;
        if (t >= len && t >= 2) {
        	pr.println("YES");
        	for (int i = 0; i < t; i++) {
        		int d = Math.min(b - x, a - y) + Math.abs(b - x - (a - y));
        		if (a - y > b - x) {
        			pr.println("^");
        			y++;
        		} else if (a - y < b - x) {
        			pr.println(">");
        			x++;
        		} else {
        			if (a - y != 0) {
        				if ((t - i - d) % 2 == 0) {
        					pr.println("^>");
        					x++;
        					y++;
        				} else {
        					pr.println(">");
        					x++;
        				}
        			} else {
        				pr.println("v<");
        				x--;
        				y--;
        			}
        		}
        	}
        } else {
        	pr.println("NO");
        }
        
        sc.close();
        pr.close();
    }

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0