HDU 5670 Machine
Machine
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 290 Accepted Submission(s):
179
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
pushed n(1≤n<2^63) times?
contains an integer T(1≤T≤15) indicating the number of test cases. For each test case:
The only line
contains two integers m(2≤m≤30) and n(1≤n<263) .
left to right.
R indicates red. G indicates green. B indicates blue.
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int j=, i, T, m, a[];
__int64 n;
cin>>T;
while(T--)
{
j=;
scanf("%d%I64d", &m, &n);
while(n!=)
{
a[++j]=n%;
n=n/;
}
while(m>j)
{
cout<<"R";
m--;
}
for(i=m;i>=;i--)
if(a[i]==)
printf("R");
else if(a[i]==)
printf("G");
else
printf("B");
printf("\n");
}
return ;
}
HDU 5670 Machine的更多相关文章
- HDU 5670 Machine 水题
Machine 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5670 Description There is a machine with m(2 ...
- hdu 3842 Machine Works(cdq分治维护凸壳)
题目链接:hdu 3842 Machine Works 详细题解: HDU 3842 Machine Works cdq分治 斜率优化 细节比较多,好好体会一下. 在维护斜率的时候要考虑x1与x2是否 ...
- 匈牙利算法模板 hdu 1150 Machine Schedule(二分匹配)
二分图:https://blog.csdn.net/c20180630/article/details/70175814 https://blog.csdn.net/flynn_curry/artic ...
- hdu 1150 Machine Schedule 最少点覆盖转化为最大匹配
Machine Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- hdu 1150 Machine Schedule 最少点覆盖
Machine Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php? ...
- hdu 1150 Machine Schedule(二分匹配,简单匈牙利算法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1150 Machine Schedule Time Limit: 2000/1000 MS (Java/ ...
- HDU 4045 Machine scheduling (组合数学-斯特林数,组合数学-排列组合)
Machine scheduling Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU 1150 Machine Schedule (二分图最小点覆盖)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1150 有两个机器a和b,分别有n个模式和m个模式.下面有k个任务,每个任务需要a的一个模式或者b的一个 ...
- POJ 1325、ZOJ 1364、HDU 1150 Machine Schedule - from lanshui_Yang
Problem Description As we all know, machine scheduling is a very classical problem in computer scien ...
随机推荐
- SQL Server2008 错误源:.net SqlClient data provider的解决方法
今天下午直接在SQL Server 2008的Microsoft SQL Server Management Studio 中修改一张表中某个字段, 不管是删除字符还是添加都提示下面的错误. 网上很多 ...
- [ubuntu] ubuntu13.04安装rabbitcvs管理svn
加入源 sudo add-apt-repository ppa:rabbitvcs/ppa 更新 sudo apt-get update 安装软件 sudo apt-get install rabbi ...
- 用VS2010编C#程序扫盲
0. Properties文件夹 定义你程序集的属性 项目属性文件夹 一般只有一个 AssemblyInfo.cs 类文件,用于保存程序集的信息,如名称,版本等,这些信息一般与项目属性面板中的数据对应 ...
- session_start()一些问题
session问题集锦 对于PHP的session功能,始终找不到合适的答案,尤其是一些错误,还有一些没有错误的结果,最可怕的就是后者,一直为许多的初学者为难.就连有些老手,有时都被搞得莫名其妙.本文 ...
- IE和FF区别关于css和js
css 1.ul标签FF中有padding值,没有margin,IE中相反 解决办法:将ul的padding和margin都设为0, js 1.IE中innerText在火狐中没有,使用textCon ...
- HAVING用法详解
HAVING 子句对 GROUP BY 子句设置条件的方式与 WHERE 和 SELECT 的交互方式类似.WHERE 搜索条件在进行分组操作之前应用:而 HAVING 搜索条件在进行分组操作之后应用 ...
- UIViewController卸载过程(ios6.0以后)
在ios6.0以后,废除了viewWillUnload方法和viewDidUnload方法. 在ios6以后,当收到didReceiveMemoryWarning消息调用之后,程序会自动调用didRe ...
- js操作记录
让checkbox全选 $("#checkall").click(function(){ $("input[name='checklist']").prop(& ...
- 【python cookbook】【数据结构与算法】18.将名称映射到序列的元素中
问题:希望通过名称来访问元素,减少结构中对位置的依赖性 解决方案:使用命名元组collections.namedtuple().它是一个工厂方法,返回的是python中标准元组类型的子类,提供给它一个 ...
- javaWeb request乱码处理
//解决get方式提交的乱码 String name = request.getParameter("name"); name=new String(u ...