讨论 / ac100 萌新一枚不喜勿喷
das 2018-02-04 16:00:13
点我顶贴 收藏 删除
#include <iostream>

#include <vector>

using namespace std;

int abs(int x)

{

if(x<0){return -x;}

else{return x;}

}

int main()

{

vector<char> res;

char re{'s'};

while(re!='E')

{

cin>>re;

res.push_back(re);

}

int n{1};

while(n<=res.size())

{

int le{0},ri{0};

while(((le<11&&ri<11)||abs(le-ri)<2)&&n<=res.size())

{

if(res[n-1]=='W'){le+=1;}

if(res[n-1]=='L'){ri+=1;}

n++;

}

cout<<le<<':'<<ri<<'\n';

}

cout<<'\n';

n=0;

while(n<=res.size())

{

int le{0},ri{0};

while(((le<21&&ri<21)||abs(le-ri)<2)&&n<=res.size())

{

if(res[n-1]=='W'){le+=1;}

if(res[n-1]=='L'){ri+=1;}

n++;

}

cout<<le<<':'<<ri<<'\n';

}

}

查看更多回复
提交回复