/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 4ms 512.0 KiB
#4 Accepted 4ms 328.0 KiB
#5 Accepted 4ms 328.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int tcase;
    cin >> tcase;
    string pen = "RGB";
    while (tcase--)
    {
        int n, temp;
        cin >> n;
        int final;
        final = n%6;
        for (int i = 1; i <= final; i++)
        {
            if (i % 2 != 0)
            {
                temp = pen[1];
                pen[1] = pen[0];
                pen[0] = temp;
            }
            else if (i % 2 == 0)
            {
                temp = pen[1];
                pen[1] = pen[2];
                pen[2] = temp;
            }
        }
        cout << pen << endl;
        pen = "RGB";
    }
    // cout << pen << endl;
}

Information

Submit By
Type
Submission
Problem
P1010 Red Green Blue
Contest
Brain booster - 1
Language
C++20 (G++ 13.2.0)
Submit At
2023-12-31 15:05:06
Judged At
2024-10-03 14:07:13
Judged By
Score
100
Total Time
4ms
Peak Memory
540.0 KiB