题目链接:1333: Sequential game

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)的更多相关文章

  1. WUSTOJ 1324: Base64 Coding(Java)未解决,求题解

    题目链接:1324: Base64 Coding 资料:ASCII码表 原文是英文,而且篇幅较长.因此下面不粘贴原文,只写中文大意. Description Base64是一种编码算法.它的工作原理是 ...

  2. WUSTOJ 1346: DARK SOULS(Java)并查集

    题目链接:1346: DARK SOULS 并查集系列:WUSTOJ 1319: 球(Java)并查集 Description CQ最近在玩一款游戏:DARK SOULS,这是一款以高难度闻名的硬派动 ...

  3. WUSTOJ 1246: 字符串排序(Java)

    1246: 字符串排序 题目   输入n(n<100)个字符串,每个字符串长度不超过1000,将他们按字典顺序输出.更过内容点击标题. 分析   Java中的ArrayList()可以比较方便的 ...

  4. WUSTOJ 1251: 报数游戏(Java)

    1251: 报数游戏 原题链接 Description n个人站成一行玩一个报数游戏.所有人从左到右编号为1到n.游戏开始时,最左边的人报1,他右边的人报2,编号为3的人报3,等等.当编号为n的人(即 ...

  5. WUSTOJ 1339: 土豪fcbruce(Java)

    题目链接:1339: 土豪fcbruce Description 10年后,就职于Google的fcbruce赞助了武汉科技大学好多钱,学校因此决定扩建.第一步是新建宿舍楼,为了整洁美观,fcbruc ...

  6. WUSTOJ 1323: Repeat Number(Java)规律统计

    题目链接:1323: Repeat Number Description Definition: a+b = c, if all the digits of c are same ( c is mor ...

  7. WUSTOJ 1321: Alphabet Cookies(Java)字符统计

    题目链接:1321: Alphabet Cookies Description Kitty likes cookies very much, and especially the alphabet c ...

  8. WUSTOJ 1336: Lucky Boy(Java)博弈

    题目链接:1336: Lucky Boy 参考博客:LUCKY BOY 博弈--HandsomeHow Description Recently, Lur have a good luck. He i ...

  9. 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 ...

随机推荐

  1. 【TensorFlow官方文档】MNIST机器学习入门

    MNIST是一个入门级的计算机视觉数据集,它包含各种手写数字图片:它也包含每一张图片对应的标签,告诉我们这个是数字几.比如,下面这四张图片的标签分别是5,0,4,1. 从一个很简单的数学模型开始:训练 ...

  2. Oracle导出/导入数据库的三种模式

    导出 模式一:全量导出(慎用) exp 用户名/密码@数据库实例 owner=用户名 file=文件存储路径 log=日志存储路径 full=y 栗子:exp Mark/123456@151.2.*. ...

  3. 狼人杀面杀APP(FGUI教程)

    本教程为FairyGUI进阶教程,这是一套完整的面杀桌游APP.游戏不仅有发放随机身份的功能,还涉及10个页面的切换与各页面不同状态(最多达9种状态)的切换,众多复杂UI的交互,多语言切换,3D粒子在 ...

  4. Nginx-实践篇(重要)

    原文链接:https://blog.csdn.net/Fe_cow/article/details/84672361

  5. SKU是什么意思?

    在做电商项目时候必定会遇到这个词,那是什么意思呢?其实简单来讲就是一个单位. SKU全称为Stock Keeping Unit(库存量单位),即库存进出计量的基本单元,可以是以件,盒,托盘等为单位.S ...

  6. QtCore概述

    所有其他Qt模块都依赖于这个模块. 要包含模块类的定义,请使用以下指令: include < QtCore > 如果您使用qmake来构建您的项目,则默认将QtCore包含在内. 核心功能 ...

  7. kafka笔记博客

    大数据数据流组件选择: https://www.cnblogs.com/yinzhengjie/articles/11155051.html 初识Apache Kafka 核心概念: https:// ...

  8. 006 DOM节点操作与元素的创建

    一:节点 1.节本基本概念 节点主要有标签,属性,文本[包括文字,空格,换行,回车]. 2.节点的属性 可以使用标签,元素点出来 可以使用标签,点出来 可以使用文本,点出来 nodeType:1--标 ...

  9. SonarQube Detection of Injection Flaws in Java, C#, PHP

    Code Quality Tools Review: Sonar, PMD, Findbugs and Checkstyle Sonar CheckStyle, FindBugs and PMD - ...

  10. Navicat Premium 12 mysql show error: connection is being used

    错误原因:连接数满了. 解决方案:杀掉无用连接,释放资源.