QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#701583#9521. Giving Directions in Harbinyzhx#RE 0ms0kbC++20951b2024-11-02 14:23:392024-11-02 14:23:39

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 14:23:39]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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

output:


result: