ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#193205 | #968. 乒乓球 | lyz111 | 100 | 38ms | 1384kb | C++ | 990b | 2023-10-14 09:42:41 | 2023-10-14 09:42:43 |
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
string com;
int a[10000] = {0}, b[10000] = {0}, k = 0;
int a2[10000] = {0}, b2[10000] = {0}, k2 = 0;
while (true)
{
cin >> com;
bool Ed = false;
for (int i = 0; i <= com.length(); i++)
{
if (com[i] == 'E')
{
Ed = true;
break;
}
if (com[i] == 'W')
{
a[k]++;
if ((a[k] == 11 && b[k] <= 9) || (a[k] > 11 && b[k] <= a[k] - 2)) k++;
a2[k2]++;
if ((a2[k2] == 21 && b2[k2] <= 19) || (a2[k2] > 21 && b2[k2] <= a2[k2] - 2)) k2++;
}
if (com[i] == 'L')
{
b[k]++;
if ((b[k] == 11 && a[k] <= 9) || (b[k] > 11 && a[k] <= b[k] - 2)) k++;
b2[k2]++;
if ((b2[k2] == 21 && a2[k2] <= 19) || (b2[k2] > 21 && a2[k2] <= b2[k2] - 2)) k2++;
}
}
if (Ed) break;
}
for (int i = 0; i <= k; i++) cout << a[i] << ":" << b[i] << endl;
cout << endl;
for (int i = 0; i <= k2; i++) cout << a2[i] << ":" << b2[i] << endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1384kb
input:
WLWLWLWLWLWLWLWLWLWL WLWLWLWLWLWLWLWLWLWL WLWLWLWLWLWLWLWLWLWL WLWLWLWLWLWLWLWLWLWL WLWLWLWLWLWLWLWL...
output:
148:148 148:148
result:
ok 3 lines
Test #2:
score: 10
Accepted
time: 0ms
memory: 1380kb
input:
WWWWLWWLLWLWWWWWWWWL LWLLLWWLWLLWWLWWWWWW WWLLWWLLLWWWWWLWWWLL LWWWWWLLWWWWLWWWWWWW WWLWLLWLLLLLWWWW...
output:
11:4 11:9 11:5 11:4 11:3 11:9 11:5 11:7 11:4 11:9 11:3 11:8 11:0 11:2 14:12 11:6 11:3 11:5 11:6 11:7...
result:
ok 275 lines
Test #3:
score: 10
Accepted
time: 5ms
memory: 1384kb
input:
LLWWWWLLWLWWWWLLLWWL LWLLLLWLLWWLLWLLLWLW LWLLWWWLLWWLWLLLWWLW WWLLWWWLLWWWLLWWWLWL LLLWWLLWLLLLLWLL...
output:
11:8 5:11 9:11 11:6 7:11 3:11 5:11 6:11 10:12 8:11 11:8 20:18 5:11 11:5 5:11 9:11 11:7 11:9 12:10 13...
result:
ok 809 lines
Test #4:
score: 10
Accepted
time: 0ms
memory: 1384kb
input:
WWWWWWWWWWWEadfadf;jadf
output:
11:0 0:0 11:0
result:
ok 4 lines
Test #5:
score: 10
Accepted
time: 0ms
memory: 1384kb
input:
WWWWWWWWWWWWWWWWWWWW WWLWE
output:
11:0 11:0 1:1 21:0 2:1
result:
ok 6 lines
Test #6:
score: 10
Accepted
time: 11ms
memory: 1384kb
input:
LLLLLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLL LLLLLLLLLLLLLLLL...
output:
0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 0:11 ...
result:
ok 2773 lines
Test #7:
score: 10
Accepted
time: 0ms
memory: 1384kb
input:
WWLWWWWLWWWWLWWWWWWL WWWWWLWWWWWLWWWWWLWW WWLWWWWWLWLWWLWLLWWL WWLLLWWWLWLWWLWWWWWW WWWWWWLLWLWWLWWL...
output:
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 ...
result:
ok 187 lines
Test #8:
score: 10
Accepted
time: 0ms
memory: 1380kb
input:
EWLWLWL
output:
0:0 0:0
result:
ok 3 lines
Test #9:
score: 10
Accepted
time: 20ms
memory: 1384kb
input:
WWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWW...
output:
11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 11:0 ...
result:
ok 6928 lines
Test #10:
score: 10
Accepted
time: 2ms
memory: 1384kb
input:
LWWWLLLLWWWWWLLLWWLL LLWLLLLWLWLLLWWLWWLW WLLWLLLLLWLLLLLWLLWL WWLLWLWLLLLWLWLLWLWL WLLLLWLLLWWWLWLL...
output:
10:12 9:11 2:11 7:11 5:11 11:5 5:11 11:8 12:10 11:6 9:11 11:8 5:11 11:6 11:2 11:6 7:11 8:11 8:11 3:1...
result:
ok 398 lines