HDU 5670 Machine
来源:互联网 发布:淘宝店铺收费标准 编辑:程序博客网 时间:2024/06/05 08:02
Machine
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 426 Accepted Submission(s): 257
Problem Description
There is a machine with m(2≤m≤30) coloured bulbs and a button.When the button is pushed, the rightmost bulb changes.
For any changed bulb,
if it is red now it will be green;
if it is green now it will be blue;
if it is blue now it will be red and the bulb that on the left(if it exists) will change too.
Initally all the bulbs are red. What colour are the bulbs after the button be
pushedn(1≤n<263) times?
For any changed bulb,
if it is red now it will be green;
if it is green now it will be blue;
if it is blue now it will be red and the bulb that on the left(if it exists) will change too.
Initally all the bulbs are red. What colour are the bulbs after the button be
pushed
Input
There are multiple test cases. The first line of input contains an integerT(1≤T≤15) indicating the number of test cases. For each test case:
The only line contains two integersm(2≤m≤30) and n(1≤n<263) .
The only line contains two integers
Output
For each test case, output the colour of m bulbs from left to right.
R indicates red. G indicates green. B indicates blue.
R indicates red. G indicates green. B indicates blue.
Sample Input
23 12 3
Sample Output
RRGGR
Source
BestCoder Round #81 (div.2)
Recommend
wange2014 | We have carefully selected several similar problems for you: 5674 5673 5672 5671 5669
类似于三进制。。。当时为什么我就没想起来呢
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){char s[3]={'R','G','B'},ans[32];int t,m,i;__int64 n;scanf("%d",&t);while(t--){scanf("%d%I64d",&m,&n);for(i=m;i>0;i--){ans[i]=s[n%3];n=n/3;}for(i=1;i<=m;i++)printf("%c",ans[i]);printf("\n");}return 0;}
1 0
- hdu 5670 Machine(水题)
- HDU 5670 Machine
- HDU 5670 Machine
- HDU 5670 Machine
- hdu--5670--Machine (模拟三进制)
- hdu 5670 Machine(模拟)
- [hdu 5670][BestCoder Round #81 t1] Machine
- HDU 5670 Machine(水题锻炼思维)
- hdu 5670 Machine(BC规律题)
- hdu 4045 Machine scheduling
- hdu 1150 Machine Schedule
- hdu 1150 Machine Schedule
- hdu 1150 Machine Schedule
- HDU 1150 Machine Schedule
- hdu 1150 Machine Schedule
- HDU-1150-Machine Schedule
- hdu 1150 Machine Schedule
- hdu 1150 Machine Schedule
- 直接插入排序算法
- Groovy 需要注意的地方
- storyBoard的用法总结
- navicat 连接mysql报错 1129 host‘192.168.31.242’is blocked解决办法 --谷营中西软件科技园
- _use_adaptive_log_file_sync参数分析
- HDU 5670 Machine
- mongodb 日期类型
- Java中的散列映射
- Ctrl + H
- IOS适配-原理篇
- C++非模态对话框自动销毁的好方法
- 21. Merge Two Sorted Lists--java
- 写论文第四天:选择最佳的参数
- 大连旅游攻略