結果

問題 No.232 めぐるはめぐる (2)
ユーザー fura
提出日時 2020-05-14 23:32:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 628 bytes
コンパイル時間 2,083 ms
コンパイル使用メモリ 192,228 KB
最終ジャッジ日時 2025-01-10 10:57:28
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int t,a,b; scanf("%d%d%d",&t,&a,&b);
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int t,a,b; scanf("%d%d%d",&t,&a,&b);

	if(max(a,b)>t) return puts("NO"),0;
	if(a==0 && b==0 && t==1) return puts("NO"),0;

	puts("YES");

	int y=0,x=0;
	if(max(a,b)%2!=t%2){
		if(y==a && x==b){
			puts("v<");
			puts("^");
			puts(">");
			t-=2;
		}
		else if(y<a && x<b) puts("^"), y++;
		else if(y==a) puts("v"), y--;
		else if(x==b) puts("<"), x--;
		t--;
	}
	while(y<a || x<b){
		if(y<a) putchar('^'), y++;
		if(x<b) putchar('>'), x++;
		puts("");
		t--;
	}
	while(t>0){
		puts("v");
		puts("^");
		t-=2;
	}

	return 0;
}
0