結果

問題 No.232 めぐるはめぐる (2)
ユーザー FF256grhyFF256grhy
提出日時 2015-06-27 01:37:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 751 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 26,108 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 13:35:12
合計ジャッジ時間 1,540 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,348 KB
testcase_01 AC 4 ms
4,348 KB
testcase_02 AC 5 ms
4,352 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,352 KB
testcase_24 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int t, a, b;

int main(void) {
	scanf("%d%d%d", &t, &a, &b);
	if(t < a || t < b || (t == 1 && a == 0 && b == 0)) {
		printf("NO\n");
	} else {
		printf("YES\n");
		
		int am = (t - a) % 2;
		int bm = (t - b) % 2;
		
		if(t == 1) {
			if(a) { printf("^"); }
			if(b) { printf(">"); }
			printf("\n");
			return 0;
		}
		
		if(am && bm) {
			printf("^\n>\n");
		} else {
			printf("^>\n");
			if(am == 0) { printf("%c", a ? '^' : 'v'); }
			if(bm == 0) { printf("%c", b ? '>' : '<'); }
			printf("\n");
		}
		a -= am ? 1 : 2;
		b -= bm ? 1 : 2;
		
		int i;
		for(i = 0; i < t - 2; i++) {
			printf("%c", (a <= i && i % 2 == 0) ? 'v' : '^');
			printf("%c", (b <= i && i % 2 == 0) ? '<' : '>');
			printf("\n");
		}
	}
	
	return 0;
}
0