欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1266A.Competitive Programmer
Competitive Programmer
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 of them how much effort they needed to reach red.
"Oh, I just spent hours solving problems", said the -th of them.
Bob wants to train his math skills, so for each answer he wrote down the number of minutes (), thanked the grandmasters and went home. Bob could write numbers with leading zeroes — for example, if some grandmaster answered that he had spent hours, Bob could write instead of .
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 numbers, denoted , ..., .
For each of the numbers, help Bob determine whether can be a permutation of a number divisible by (possibly with leading zeroes).
Input
The first line contains a single integer () — the number of grandmasters Bob asked.
Then lines follow, the -th of which contains a single integer — the number that Alice wrote down.
Each of these numbers has between and digits '0' through '9'. They can contain leading zeroes.
Output
Output lines.
For each , output the following. If it is possible to rearrange the digits of such that the resulting number is divisible by , output "red" (quotes for clarity). Otherwise, output "cyan".
Note
In the first example, there is one rearrangement that yields a number divisible by , and that is .
In the second example, there are two solutions. One is and the second is .
In the third example, there are possible rearrangments: , , , , , . None of these numbers is divisible by .
In the fourth example, there are rearrangements: , , .
In the fifth example, none of the rearrangements result in a number divisible by .
In the sixth example, note that is a valid solution.
Samples
6
603
006
205
228
1053
0000000000000000000000000000000000000000000000
red
red
cyan
cyan
cyan
red
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |