結果
| 問題 | No.232 めぐるはめぐる (2) |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-06-27 19:55:15 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 773 bytes |
| 記録 | |
| コンパイル時間 | 501 ms |
| コンパイル使用メモリ | 54,948 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-07 20:01:42 |
| 合計ジャッジ時間 | 3,865 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 1 WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | int t,a,b;scanf("%d%d%d",&t,&a,&b);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int t,a,b;scanf("%d%d%d",&t,&a,&b);
char vertical[3]="><",horizontal[3]="^v";bool ai=a<0?1:0,bi=b<0?1:0;
if(a<0)a=-a;if(b<0)b=-b;int mlen=max(a,b);
if(t<mlen&&(t==1&&!a&&!b)){printf("NO\n");return 0;}
printf("YES\n");
int rc=mlen-min(a,b),llen=t-mlen;
llen/=2;for(int i=0;i<llen;i++)printf(">\n<\n");
if(llen%2){
if(a<b){printf("%c\n",horizontal[!ai]);a=abs(a-1);}
else{printf("%c\n",vertical[!bi]);b=abs(b-1);}
int len=min(a,b);
for(int i=0;i<len;i++)printf("%c%c\n",horizontal[ai],vertical[bi]);
len-=mlen-len;char c=a<b?vertical[bi]:horizontal[ai];
for(int i=0;i<len;i++)printf("%c\n",c);
}
return 0;
}
184