結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー |
![]() |
提出日時 | 2015-07-28 14:42:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 1,344 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 158,552 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 12:38:35 |
合計ジャッジ時間 | 2,397 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘void input()’: main.cpp:74:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 74 | scanf("%d%d%d", &t, &a, &b); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repi(i,0,n) int t, a, b; void solve() { if(t < max(a,b)) { puts("NO"); return; } int i = 0, j = 0; if((t-max(a,b))%2) { if(a and b) { puts("YES"); i++; j++; t -= 2; puts("^"); puts(">"); } else if(a or b){ puts("YES"); i++; j++; t--; puts("^>"); } else { if(t == 1) { puts("NO"); return; } else { puts("YES"); i++; j++; t--; puts("^>"); } } } else puts("YES"); while(i < a and j < b) { t--; puts("^>"); i++; j++; } while(i < a) { t--; puts("^"); i++; } while(j < b) { t--; puts(">"); j++; } if(j > b) { t--; puts("<"); } if(i > a) { t--; puts("v"); } while(t > 0) { t -= 2; puts(">"); puts("<"); } } void input() { scanf("%d%d%d", &t, &a, &b); } int main() { input(); solve(); return 0; }