CF1266A.Competitive Programmer

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting of grandmasters and asked nn of them how much effort they needed to reach red.

"Oh, I just spent xix_i hours solving problems", said the ii-th of them.

Bob wants to train his math skills, so for each answer he wrote down the number of minutes (60⋅xi60 \cdot x_i), thanked the grandmasters and went home. Bob could write numbers with leading zeroes — for example, if some grandmaster answered that he had spent 22 hours, Bob could write 000120000120 instead of 120120.

Alice wanted to tease Bob and so she took the numbers Bob wrote down, and for each of them she did one of the following independently:

  • rearranged its digits, or
  • wrote a random number.

This way, Alice generated nn numbers, denoted y1y_1, ..., yny_n.

For each of the numbers, help Bob determine whether yiy_i can be a permutation of a number divisible by 6060 (possibly with leading zeroes).

Bob 是一名竞技编程选手。他想成为红名选手,为此需要严格训练。他参加了大师们的年度会议,并向其中 nn 位询问了他们成为红名所需付出的努力。

“哦,我只花了 xix_i 小时刷题。”第 ii 位大师回答道。

为了锻炼自己的数学能力,Bob 对每位大师的回答都记录下了对应的分钟数(即 60⋅xi60 \cdot x_i),向大师们道谢后便回家了。Bob 记录数字时可能添加前导零——例如,若某位大师回答花费了 22 小时,Bob 可能写下 000120000120 而非 120120。

Alice 想捉弄 Bob,于是取走了 Bob 写下的这些数字,并对其中每一个独立地执行以下两种操作之一:

  • 重排其各位数字,或
  • 随意写下一个数字。

这样,Alice 生成了 nn 个数字,记为 y1y_1, ..., yny_n。

对每个数字,请帮助 Bob 判断:yiy_i 是否可能是某个能被 6060 整除的数(允许含前导零)的各位数字的一个排列。

输入格式

The first line contains a single integer nn (1≤n≤4181 \leq n \leq 418) — the number of grandmasters Bob asked.

Then nn lines follow, the ii-th of which contains a single integer yiy_i — the number that Alice wrote down.

Each of these numbers has between 22 and 100100 digits '0' through '9'. They can contain leading zeroes.

第一行包含一个整数 nn(1≤n≤4181 \leq n \leq 418)—— 表示 Bob 询问的国际象棋特级大师人数。

接下来是 nn 行,其中第 ii 行包含一个整数 yiy_i —— 即 Alice 写下的数字。

每个数字由 22 至 100100 位十进制数字 '0'–'9' 组成,可能包含前导零。

输出格式

Output nn lines.

For each ii, output the following. If it is possible to rearrange the digits of yiy_i such that the resulting number is divisible by 6060, output "red" (quotes for clarity). Otherwise, output "cyan".

输出 nn 行。

对于每个 ii,执行以下操作:若能重新排列 yiy_i 的各位数字,使得得到的新数能被 6060 整除,则输出 red(引号仅用于清晰起见);否则输出 cyan。

输入输出样例

  • 输入#1

    6
    603
    006
    205
    228
    1053
    0000000000000000000000000000000000000000000000

    输出#1

    red
    red
    cyan
    cyan
    cyan
    red

说明/提示

In the first example, there is one rearrangement that yields a number divisible by 6060, and that is 360360.

In the second example, there are two solutions. One is 060060 and the second is 600600.

In the third example, there are 66 possible rearrangments: 025025, 052052, 205205, 250250, 502502, 520520. None of these numbers is divisible by 6060.

In the fourth example, there are 33 rearrangements: 228228, 282282, 822822.

In the fifth example, none of the 2424 rearrangements result in a number divisible by 6060.

In the sixth example, note that 000…0000\dots0 is a valid solution.

在第一个例子中,存在一种重排方式可得到能被 6060 整除的数,即 360360。

在第二个例子中,存在两种解:其一是 060060,其二是 600600。

在第三个例子中,共有 66 种可能的重排:025025、052052、205205、250250、502502、520520。这些数中没有一个能被 6060 整除。

在第四个例子中,共有 33 种重排:228228、282282、822822。

在第五个例子中,全部 2424 种重排均不能得到能被 6060 整除的数。

在第六个例子中,请注意 000…0000\dots0 是一个合法的解。

输入解题思路,AI测评打分。不知道怎么写?

首页