結果

問題 No.675 ドットちゃんたち
ユーザー LaylaLayla
提出日時 2018-06-14 00:48:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,623 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 26,884 KB
実行使用メモリ 8,216 KB
最終ジャッジ日時 2023-09-13 04:01:41
合計ジャッジ時間 3,910 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 22 ms
4,968 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

typedef struct dot {
    int x;
    int y;
    int r_num;
} Dot;

int main() {
    int dot_num = 0;
    int initial_x, initial_y;
    scanf("%d%d%d", &dot_num, &initial_x, &initial_y);
    Dot dots[dot_num];
    int command[dot_num][2];

    for (int k = 0; k < dot_num; ++k) {
        dots[k].x = initial_x;
        dots[k].y = initial_y;
        dots[k].r_num = 0;
        scanf("%d", &command[k][0]);
        if (command[k][0] == 3) {
            for (int i = k; i < dot_num; ++i) {
                dots[k].r_num++;
            }
                continue;
        }
        scanf("%d", &command[k][1]);
        for (int i = k; i < dot_num; ++i) {
            switch (command[i][0]) {
                case 1:
                    dots[k].x += command[i][1];
                    break;
                case 2:
                    dots[k].y += command[i][1];
                    break;
            }
        }
    }

    for (int k = 0; k < dot_num; ++k) {
        switch (dots[k].r_num % 4) {
            case 1: {
                int temp = dots[k].x;
                dots[k].x = dots[k].y;
                dots[k].y = -temp;
                break;
            }
            case 2: {
                dots[k].x = -dots[k].x;
                dots[k].y = -dots[k].y;

                break;
            }
            case 3: {
                int temp = dots[k].x;
                dots[k].x = -dots[k].y;
                dots[k].y = temp;
                break;
            }
        }
    }

    for (int l = 0; l < dot_num; ++l) {
        printf("%d %d\n", dots[l].x, dots[l].y);
    }

    return 0;
}
0