WUSTOJ 1333: Sequential game(Java)
Description
Sequential detector is a very important device in Hardware experiments. But is very difficult for many students such as HeroWei. In nearest days, his teacher Miss Fang let him simulate sequence detector. But there many sequence here ,and Miss Fang add the difficulty that when she give HeroWei a sequence and a string ,you must tell her how many string here in this sequence. But now Miss Fang simplified the problem for HeroWei, she just give Herowei a sequence and let HeroWei play a game with it.
When comes a character , it must compare with the rightmost one of sequence, if it’s the same with the coming characters ,the coming one just join the string. Most the right side. Otherwise all the characters in the sequence must change its value, 0 to 1 and 1 to 0,then the coming one add to its right side. Here is an example, if there is a sequence ‘110’ when comes a character 0,the sequence become ‘1100’ at last, if comes a character 1,the sequence become ‘0011’ at last.
It’s very difficult for HeroWei to play the game. Can you help him?
Input
Each line contains a composed by a string of 0s and 1s.the input is ended by EOF.
Output
For each given sequence you just play with this string as descripted above.Output a line contains two integers ,which are the number of 0s and 1s in the sequence after the game.
Sample Input
0
000
110
1111
1010
010100
Sample Output
1 0
3 0
0 4
4 0
分析
WUSTOJ 1333: Sequential game(Java)的更多相关文章
- WUSTOJ 1324: Base64 Coding(Java)未解决,求题解
题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...
- WUSTOJ 1346: DARK SOULS(Java)并查集
题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...
- WUSTOJ 1246: 字符串排序(Java)
1246: 字符串排序 题目 输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析 Java中的ArrayList()可以比较方便的 ...
- WUSTOJ 1251: 报数游戏(Java)
1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...
- WUSTOJ 1339: 土豪fcbruce(Java)
题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...
- WUSTOJ 1323: Repeat Number(Java)规律统计
题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...
- WUSTOJ 1321: Alphabet Cookies(Java)字符统计
题目链接:1321: Alphabet Cookies Description Kitty likes cookies very much, and especially the alphabet c ...
- WUSTOJ 1336: Lucky Boy(Java)博弈
题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...
- WUSTOJ 1335: Similar Word(Java)
题目链接:1335: Similar Word Description It was a crummy day for Lur. He failed to pass to the CET-6 (Col ...
随机推荐
- PHP的ini_set函数用法
PHP ini_set用来设置php.ini的值,在函数执行的时候生效,脚本结束后,设置失效.无需打开php.ini文件,就能修改配置,对于虚拟空间来说,很方便. 函数格式:string in ...
- mysql批量更新update中的锁表机制
mysql的行锁是通过索引加载的,即行锁是加在索引响应的行上的,要是对应的SQL语句没有走索引,则会全表扫描,行锁则无法实现,取而代之的是表锁. CREATE TABLE SIMPLE_USER( I ...
- Eclipse/STS选择一段文本进行复制变得很卡的解决方案
网上给出的解决方案是: 更改打开代码超链接按键Ctrl为Alt:Window -> Preferences -> General -> Editors -> Text Edit ...
- post请求头中常见content-type(非常重要)
定义和用法 enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码.默认地,表单数据会编码为 "application/x-www-form-urlencoded". ...
- Vue-CLI 标准开发工具-快速准备环境和创建项目
https://cli.vuejs.org/zh/ 淘宝镜像安装: npm install -g cnpm --registry=https://registry.npm.taobao.org 2.x ...
- Springboot项目mysql日期存储不匹配问题和在idea本地可以运行起来,但打包jar后运行报找不到mysql驱动的解决方案
修改pop.xml中scope的值,如果是具体版本号,修改为如下即可解决 <dependency> <groupId>mysql</groupId> <art ...
- openresty开发系列10--openresty的简单介绍及安装
openresty开发系列10--openresty的简单介绍及安装 一.Nginx优点 十几年前,互联网没有这么火,软件外包开发,信息化建设,帮助企业做无纸化办公,收银系统,工厂erp,c/s架构偏 ...
- 【转载】 clusterdata-2011-2 谷歌集群数据分析(三)
原文地址: https://blog.csdn.net/yangss123/article/details/78306270 由于原文声明其原创文章不得允许不可转载,故这里没有转载其正文内容. --- ...
- Python3基础 for-else break、continue跳出循环示例
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
- js 跳转到 百度指定地址定位点
js 跳转到 百度指定地址定位点 http://api.map.baidu.com/geocoder?address=北京市海淀区上地信息路9号奎科科技大厦&output=html&s ...
题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...
题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...
1246: 字符串排序 题目 输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析 Java中的ArrayList()可以比较方便的 ...
1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...
题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...
题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...
题目链接:1321: Alphabet Cookies Description Kitty likes cookies very much, and especially the alphabet c ...
题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...
题目链接:1335: Similar Word Description It was a crummy day for Lur. He failed to pass to the CET-6 (Col ...
PHP ini_set用来设置php.ini的值,在函数执行的时候生效,脚本结束后,设置失效.无需打开php.ini文件,就能修改配置,对于虚拟空间来说,很方便. 函数格式:string in ...
mysql的行锁是通过索引加载的,即行锁是加在索引响应的行上的,要是对应的SQL语句没有走索引,则会全表扫描,行锁则无法实现,取而代之的是表锁. CREATE TABLE SIMPLE_USER( I ...
网上给出的解决方案是: 更改打开代码超链接按键Ctrl为Alt:Window -> Preferences -> General -> Editors -> Text Edit ...
定义和用法 enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码.默认地,表单数据会编码为 "application/x-www-form-urlencoded". ...
https://cli.vuejs.org/zh/ 淘宝镜像安装: npm install -g cnpm --registry=https://registry.npm.taobao.org 2.x ...
修改pop.xml中scope的值,如果是具体版本号,修改为如下即可解决 <dependency> <groupId>mysql</groupId> <art ...
openresty开发系列10--openresty的简单介绍及安装 一.Nginx优点 十几年前,互联网没有这么火,软件外包开发,信息化建设,帮助企业做无纸化办公,收银系统,工厂erp,c/s架构偏 ...
原文地址: https://blog.csdn.net/yangss123/article/details/78306270 由于原文声明其原创文章不得允许不可转载,故这里没有转载其正文内容. --- ...
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
js 跳转到 百度指定地址定位点 http://api.map.baidu.com/geocoder?address=北京市海淀区上地信息路9号奎科科技大厦&output=html&s ...