QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
1 2 S 2 E 1