Imps --此题主要是体会下效率
来源:互联网 发布:电子产品目录软件 编辑:程序博客网 时间:2024/06/05 19:35
Problem Description
The world is in danger. One famous swindler passed away recently (by the way, nobody knows his real name, so let's call him Ostap). Having got to the hell he decided to make a deal with the Devil. More precisely, it was, actually, not a deal but a stake in a totalizator. The rules of the game are quite simple. Several imps divide into two teams — “black” and “grimy”. Then they go to the game field. Numbers from 1 to n are written on the field, and the teams do their turns one after another by putting down with black ink signs of + and - between the numbers. When there is no two adjacent numbers without sign between them left, players calculate the result of obtained expression on the field. The goal of the “black” team is to make this result even, the goal of the “grimy” team is to make it odd. All four imps are experts in this game, therefore they always do optimal turns. “Black” team plays first.
The totalizator rules are the following: if Ostap guesses which team wins, he will get his life back. Otherwise, the Devil will get the power over the whole world. The stakes are high, so you have to help Ostap with determining the winner.
The totalizator rules are the following: if Ostap guesses which team wins, he will get his life back. Otherwise, the Devil will get the power over the whole world. The stakes are high, so you have to help Ostap with determining the winner.
Input
Multiple cases.
Each case is a single integer n(1<=n<=0x7FFFFFFF).
Each case is a single integer n(1<=n<=0x7FFFFFFF).
Output
If “black” team wins output “b”, otherwise output “g”.
Sample Input
14
Sample Output
g
b
一直听师兄说用C的输入输出比C++快很多。这道题才真正让我体会到。用C是78MS。用C++超时。。
#include <iostream>#include <cstdio>using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { if(n%4==0||n%4==3)printf("b\n"); else printf("g\n"); } return 0;}
- Imps --此题主要是体会下效率
- 读取Assets目录下的文件信息(此处主要是读取Zip包和Apk的信息)
- Java的内存复制(主要是数组)效率比较
- 衡量查找算法效率的主要标准是( )。
- 体会下
- 再传一点今天的开发日志上来,主要是String和StringBuffer效率问题比较
- 效率优化的一些体会
- Qt在Ubuntu下编译小记(主要是字体问题)
- Android SDK 目录下的文件夹主要是干什么的
- 即时通信(IMPS)
- 1924. Four Imps-博弈论
- 是夜 到此
- 主要是INV库存
- linux-windows下串口编程(主要是linux下通过串口进行烧写hex)
- 文摘,好好体会下
- 效率jiu是高
- 效率是个大问题
- 学习计划,订下此计划是为了督促自己不断学习。
- 第一次上机实验报告
- get_template_directory_uri() 模板目录
- Slave服务器中datanode启动后又自动关闭
- NYOJ - 士兵杀敌(一)
- STK AzEI蒙版工具的使用方法
- Imps --此题主要是体会下效率
- 在U-boot上搭建TFTP服务器
- Syscall系统调用Linux内核跟踪
- 字节序/CPU大小端
- contiki2.6之Makefile详细解读二
- Java笔记2
- 修改使用XCODE来管理项目的用户名和密码
- Data Guard RMAN-04006 和 ORA-01017 错误诊断
- 十进制转化为2进制