1 条题解

  • 0
    @ 2026-8-20 11:48:42

    #include <bits/stdc++.h> using namespace std;

    int main() { int x, y, z, q; cin >> x >> y >> z >> q; int cnt = 1; int n = 1; string s = "red"; while (cnt <= q) { if (n == x + y + z + y + 1) { n = 1; } if (n >= 1 && n <= x) { s = "red"; } else if (n >= x + 1 && n <= x + y) { s = "yellow"; } else if (n >= x + y + 1 && n <= x + y + z) { s = "green"; } else if (n >= x + y + z + 1 && n <= x + y + z + y) { s = "yellow"; } n++; cnt++; } cout << s; }

    • 1

    信息

    ID
    31231
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    142
    已通过
    24
    上传者