博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
P1042 乒乓球
阅读量:7249 次
发布时间:2019-06-29

本文共 799 字,大约阅读时间需要 2 分钟。

注意:
真正的规则:达到11或21分后,要等到两人分值差>=2时才算完成一局。

#include
#include
#include
#include
#include
#include
using namespace std;char c,a[100001];int numw,numl,cnt;int main(){ while(cin>>a[++cnt]) { if(a[cnt]=='E'){cnt--;break;} } for(int i=1;i<=cnt;i++) { if(a[i]=='W') numw++; if(a[i]=='L') numl++; if((numw>=11||numl>=11)&&abs(numl-numw)>=2) { printf("%d:%d\n",numw,numl); numw=numl=0; } } printf("%d:%d\n",numw,numl);numw=numl=0; puts(""); for(int i=1;i<=cnt;i++) { if(a[i]=='W') numw++; if(a[i]=='L') numl++; if((numw>=21||numl>=21)&&abs(numl-numw)>=2) { printf("%d:%d\n",numw,numl); numw=numl=0; } } printf("%d:%d\n",numw,numl); return 0;}

转载于:https://www.cnblogs.com/dfsac/p/7587799.html

你可能感兴趣的文章
oracle概念和术语 建表时的一些参数pctfree initrans maxtrans sto
查看>>
我的友情链接
查看>>
转ApplicationContext的三种实现方式以及在web.xml配置的两种方式
查看>>
【我的软考之路】我的网工备考之路~
查看>>
mysql5.7.10安装
查看>>
IP数据包的分片与重组过程
查看>>
命好不如习惯好
查看>>
/etc/X11/xorg.conf 文件被误改后进不了图形化界面
查看>>
Android 通过反射及AIDL获取双卡手机SIM卡相关信息,及注册监听
查看>>
shell批量新建文件及批量改名
查看>>
APP适配安卓手机刘海屏
查看>>
bind10 新版本发布(版本号bind10-devel-20120816)
查看>>
junit 参数化测试
查看>>
分区表维护
查看>>
听说iPhone X到货了,识别体验是不是科技感爆棚?
查看>>
windows server2012中创建密码重设盘
查看>>
openstack-icehouse部署中遇到的一些故障(小笔记)
查看>>
redhat 替换 yum
查看>>
Google决定用gLinux取代Goobuntu Linux操作系统
查看>>
《将博客搬至CSDN》
查看>>