結果

問題 No.232 めぐるはめぐる (2)
ユーザー IL_mstaIL_msta
提出日時 2015-06-26 23:23:08
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,650 bytes
コンパイル時間 884 ms
コンパイル使用メモリ 85,132 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 01:39:04
合計ジャッジ時間 2,739 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>

#include <algorithm>
#include <cmath>

#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>

/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////

int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(6);//
	
	int T,A,B;
	cin>>T>>A>>B;
	//T回連続移動で(A,B)へ
	int min;
	if(A>B){
		min = A;
	}else {
		min = B;
	}
	
	if(T < min){
		P("NO");
		return 0;
	}
	else if( T==1 && A==0 && B==0){
		P("NO");
		return 0;
	}
	P("YES");
	if( (T -min)%2 == 0){
		//if(T==min)
		{
			if(A==B){
				rep(i,min){cout << "^>\n";}//右上
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}else if(A>B){
				rep(i,B){cout<<"^>\n";}
				rep(i,A-B){cout<<"^\n";}
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}else{//A<B
				rep(i,A){cout<<"^>\n";}
				rep(i,B-A){cout<<">\n";}
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}
		}
	}else{//(T -min)%2 == 1)
		{
			if(A==B){
				rep(i,min-1){cout << "^>\n";}
				cout<<"^\n>\n";
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}else if(A>B){
				rep(i,B-1){cout<<"^>\n";}
				cout<<">\n^\n";
				rep(i,A-B){cout<<"^\n";}
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}else{//A<B
				rep(i,A-1){cout<<"^>\n";}
				cout<<"^\n>\n";
				rep(i,B-A){cout<<">\n";}
				rep(i,(T-min)/2){
					cout<<"<\n>\n";
				}
			}
		}
	}
	
	return 0;
}
0