Accepted
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-11-11 03:46:00
- Judged By
- Score
- 100
- Total Time
- 3ms
- Peak Memory
- 324.0 KiB