結果
| 問題 |
No.232 めぐるはめぐる (2)
|
| コンテスト | |
| ユーザー |
kapo
|
| 提出日時 | 2016-05-09 08:50:56 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 951 bytes |
| コンパイル時間 | 473 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 12:42:45 |
| 合計ジャッジ時間 | 1,598 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d", &t, &a, &b);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void)
{
int i, t, a, b, x=0, y=0, c=0, f=0;
scanf("%d %d %d", &t, &a, &b);
if( t < a || t < b || ( t==1 && !a && !b ) ) {
printf("NO\n");
return 0;
}
printf("YES\n");
if( !c && t >= 2 ) {
if( !a && !b) {
printf("<v\n");
x--;
y--;
c++;
} else if( !a ) {
printf(">v\n");
x++;
y--;
c++;
} else if( !b ) {
printf("<^\n");
x--;
y++;
c++;
}
}
while( y < a-1 && x < b-1) {
printf("^>\n");
x++;
y++;
c++;
}
while( y < a-1 ) {
printf("^\n");
y++;
c++;
}
while( x < b-1 ) {
printf(">\n");
x++;
c++;
}
while( c < t-1 ) {
if( !f ) {
printf(">\n");
x++;
c++;
f = 1;
} else if( f ) {
printf("<\n");
x--;
c++;
f = 0;
}
}
if( a == y+1 && b == x+1) {
printf("^>\n");
x++;
y++;
c++;
} else if( a == y+1 ) {
printf("^\n");
y++;
c++;
} else if( b == x+1 ) {
printf(">\n");
x++;
c++;
}
return 0;
}
kapo