讨论 / 帮我看看,第二个点
蔡旭昀 2013-02-20 02:54:00
点我顶贴 收藏 删除
[color=blue]第二个点,[color=red]经过换行处理,[color=green]为什么这样?

[color=red]错误答案:

11:3 11:2 11:2 11:4 11:9 11:0 11:7 11:4 11:9 11:4 11:3 11:5 11:8 11:9 11:6 11:5 11:8 11:4 11:3 11:3 11:4 11:9 11:1 11:7 11:6

11:4 11:3 11:8 12:10 11:4 11:4 11:3 11:6 11:7 11:2 11:3 11:8 11:3 12:10 11:5 11:7 11:8 9:11 11:4 11:3 11:7 11:5 11:8 11:2

11:9 11:7 11:5 11:1 11:7 11:6 11:6 12:10 11:4 11:9 7:11 11:2 11:8 11:5 11:3 11:9 11:7 11:9 11:2 9:11 11:3 11:3 8:11 11:1 11:2

11:4 11:5 11:4 11:1 11:6 11:4 11:7 11:4 11:4 11:7 8:11 11:6 11:5 11:3 11:2 16:18 11:7 11:4 11:7 11:5 11:3 14:12 11:3 11:3

11:3 11:7 11:8 11:4 11:4 11:5 11:6 11:9 11:0 11:7 11:6 12:10 11:4 11:2 11:2 11:5 11:8 11:9 11:3 11:4 11:5 11:7 11:5 2:0

21:4 21:6 21:10 21:10 21:11 21:6 21:18 21:11 21:13 21:6 21:7 21:10 21:12 21:8 21:17 21:6 21:10 21:9 21:5 21:11 21:15 21:15

21:15 21:10 21:12 21:6 21:16 21:9 21:8 21:15 21:13 21:17 21:11 21:10 21:17 21:12 21:7 21:11 21:8 21:7 21:7 21:11 21:8 21:16

21:13 21:5 22:20 21:12 21:9 21:14 21:7 21:7 21:12 21:11 21:9 21:8 21:13 21:13 21:4 21:13 21:10 21:10 21:11 18:10

正确答案:

11:3 11:2 11:2 11:4 11:9 11:0 11:7 11:4 11:9 11:4 11:3 11:5 11:8 11:9 11:6 11:5 11:8 11:4 11:3 11:3 11:4 11:9 11:1 11:7 11:6

11:4 11:3 11:8 12:10 11:4 11:4 11:3 11:6 11:7 11:2 11:3 11:8 11:3 12:10 11:5 11:7 11:8 9:11 11:4 11:3 11:7 11:5 11:8 11:2

11:9 11:7 11:5 11:1 11:7 11:6 11:6 12:10 11:4 11:9 7:11 11:2 11:8 11:5 11:3 11:9 11:7 11:9 11:2 9:11 11:3 11:3 8:11 11:1 11:2

11:4 11:5 11:4 11:1 11:6 11:4 11:7 11:4 11:4 11:7 8:11 11:6 11:5 11:3 11:2 16:18 11:7 11:4 11:7 11:5 11:3 14:12 11:3 11:3

11:3 11:7 11:8 11:4 11:4 11:5 11:6 11:9 11:0 11:7 11:6 12:10 11:4 11:2 11:2 11:5 11:8 11:9 11:3 11:4 11:5 11:7 11:5 2:0

21:4 21:6 21:10 21:10 21:11 21:6 21:18 21:11 21:13 21:6 21:7 21:10 21:12 21:8 21:17 21:6 21:10 21:9 21:5 21:11 21:15 21:15

21:15 21:10 21:12 21:6 21:16 21:9 21:8 21:15 21:13 21:17 21:11 21:10 21:17 21:12 21:7 21:11 21:8 21:7 21:7 21:11 21:8 21:16

21:13 21:5 22:20 21:12 21:9 21:14 21:7 21:7 21:12 21:11 21:9 21:8 21:13 21:13 21:4 21:13 21:10 21:10 21:11 7:2

[color=green]代码:

#include<iostream>

using namespace std;

int main()

{

char ch;

string h="";

int a=0,b=0,n=0;

ch=getchar();

while(ch!='E') {if(ch=='W' || ch=='L') h+=ch;++n;ch=getchar();}

if(h=="") {printf("0:0\n\n0:0");return 0;}

for(int i=0;i<=(h.size()-1);++i)

{

if(h[i]=='W') ++a;

if(h[i]=='L') ++b;

if((a>=11 || b>=11) && ((a-b)>=2 || (b-a)>=2)) printf("%d:%d\n",a,b),a=0,b=0;

}

printf("%d:%d\n\n",a,b);

a=0;b=0;

for(int i=0;i<=n;++i)

{

if(h[i]=='W') ++a;

if(h[i]=='L') ++b;

if((a>=21 || b>=21) && ((a-b)>=2 || (b-a)>=2)) cout << a << ':' << b << endl,a=0,b=0;

}

printf("%d:%d\n",a,b);

return 0;

}

#1 蔡旭昀@2013-02-20 02:53:00
回复 删除
以解决

[color=red]请无视此楼

#2 蔡旭昀@2013-02-20 02:54:00
回复 删除
[color=green]==========此贴终结==========
查看更多回复
提交回复