讨论 / 为什么第六个测试点超时啊
Hujun1413 2016-08-23 12:30:34
点我顶贴 收藏 删除
测试点1 Accepted / 1ms / 12392kB

测试点2 Accepted / 5ms / 12392kB

测试点3 Accepted / 5ms / 12392kB

测试点4 Accepted / 13ms / 12392kB

测试点5 Accepted / 27ms / 12392kB

测试点6 Unaccepted / 选手程序运行超过时限

测试点7 Accepted / 127ms / 12392kB

测试点8 Accepted / 1ms / 12392kB

测试点9 Accepted / 5ms / 12392kB

测试点10 Accepted / 1ms / 12392kB

下面是源码:

#include <iostream>

#include <cstring>

#include <vector>

using namespace std;

int main()

{

char str;

int firsta = 0, firstb = 0;

int seconda = 0, secondb = 0;

vector<int> firstW,firstL;

vector<int> secondW,secondL;

while(cin >> str)

{

if(str == 'W')

{

++firsta;

++seconda;

}

else if(str == 'L')

{

++firstb;

++secondb;

}

else if(str == 'E')

{

firstW.push_back(firsta);

firstL.push_back(firstb);

secondW.push_back(seconda);

secondL.push_back(secondb);

break;

}

if((firsta >= 11 && firsta-firstb >= 2) || (firstb >= 11 && firstb-firsta >= 2))

{

firstW.push_back(firsta);

firstL.push_back(firstb);

firsta = 0;

firstb = 0;

}

if((seconda >= 21 && seconda-secondb >= 2) || (secondb >= 21 && secondb-seconda >= 2))

{

secondW.push_back(seconda);

secondL.push_back(secondb);

seconda = 0;

secondb = 0;

}

}

for(int i=0; i<firstW.size(); ++i)

{

cout << firstW.at(i) << ":" << firstL.at(i) << endl;

}

cout << endl;

for(int i=0; i<secondW.size(); ++i)

{

cout << secondW.at(i) << ":" << secondL.at(i) << endl;

}

return 0;

}

#1 笑靥@2016-09-09 10:12:03
回复 删除
为什么呀=。=请问楼主知道了不?
#2 lengjiayi@2016-11-18 17:46:03
回复 删除
同问

查看更多回复
提交回复