QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#701583 | #9521. Giving Directions in Harbin | yzhx# | RE | 0ms | 0kb | C++20 | 951b | 2024-11-02 14:23:39 | 2024-11-02 14:23:39 |
answer
#include <stdlib.h>
#include <iostream>
using namespace std;
void slove() {
// 0 W, 1 N, 2 E, 3 S
int n;
cin >> n;
int dir = 0;
char d;
int dis;
int tar = 0;
cout << (n * 2 - 1) << " ";
for (int i = 1; i <= n; i++) {
cin >> d >> dis;
if (d == 'W')
tar = 0;
else if (d == 'N')
tar == 1;
else if (d == 'E')
tar == 2;
else
tar = 3;
if (i != 1) {
if ((dir + 1) % 4 == tar)
cout << "R\n";
else
cout << "L\n";
} else {
cout << d << "\n";
}
cout << "Z " << dis << "\n";
dir = tar;
}
}
int main() {
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
int cnt = 1;
cin >> cnt;
while (cnt--) {
slove();
}
return 0;
}
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
1 2 S 2 E 1