QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#418663 | #4315. 简单的卡牌游戏 | paul2008# | WA | 0ms | 3852kb | C++14 | 1.5kb | 2024-05-23 15:03:34 | 2024-05-23 15:03:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int a[100][100];
int main()
{
//freopen("1.in", "r", stdin);
int col, x;
char c;
for (int i = 1; i <= 26; i++)
{
scanf(" %c%d", &c, &x);
if (c == 'S') col = 0;
else if (c == 'H') col = 1;
else if (c == 'C') col = 2;
else col = 3;
a[col][x] = 1;
}
int ans1 = 0, ans2 = 0;
for (int i = 0; i < 4; i++)
{
int cnt = 0, sum = 0;
bool rua = 1;
for (int j = 1; j < 7; j++)
{
if (a[i][j])
{
cnt++;
if (cnt < 0)
{
rua = 0;
cnt = 0;
}
}
else
{
cnt--;
if (cnt > 0)
{
rua = 0;
cnt = 0;
}
}
}
sum += cnt;
cnt = 0;
for (int j = 13; j > 7; j--)
{
if (a[i][j])
{
cnt++;
if (cnt < 0)
{
rua = 0;
cnt = 0;
}
}
else
{
cnt--;
if (cnt > 0)
{
rua = 0;
cnt = 0;
}
}
}
sum += cnt;
if (i == 0)
{
if (a[0][7] == 1) sum = sum + 1;
else sum = sum - 1;
}
else
{
if (a[i][7] == 1)
{
sum++;
if (sum < 0)
{
rua = 0;
sum = 0;
}
}
else
{
sum--;
if (sum > 0)
{
rua = 0;
sum = 0;
}
}
}
if (rua) ans2++;
ans1 += sum;
}
//printf("%d %d\n", ans1, ans2);
if (ans1 > 0) printf("Alice\n");
else if (ans1 < 0) printf("Bob\n");
else
{
if (ans2 == 4) printf("Draw\n");
else if (a[0][7] == 1) printf("Bob\n");
else printf("Alice\n");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
C12 S1 C7 H7 C3 D12 S5 C9 H4 S6 D10 H2 H1 S13 S10 C6 C10 H6 S7 D2 H3 D9 C13 D6 D4 H10
output:
Bob
result:
ok single line: 'Bob'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
C13 C7 C12 D11 D6 C2 D10 H1 H12 H2 S9 S10 D7 C3 H6 C6 S5 C5 D4 H4 C1 C4 D3 C8 D8 H13
output:
Alice
result:
ok single line: 'Alice'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
C5 H9 S12 D6 S10 C2 D11 S11 H5 C6 C12 C9 S4 D3 S7 S9 H1 H2 C3 S6 D1 S5 D2 H3 D12 C1
output:
Bob
result:
ok single line: 'Bob'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
D1 H9 H5 S4 D13 S8 H12 S5 D9 D5 C10 C8 D4 S12 S13 C4 H10 D6 H11 H8 C12 H2 S2 S6 H1 H13
output:
Bob
result:
ok single line: 'Bob'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
H2 D2 C9 H4 H10 C1 D1 D8 H7 C10 C3 S3 D10 S13 D6 C13 D5 C6 S8 H11 H3 H9 S4 S6 D13 H6
output:
Alice
result:
ok single line: 'Alice'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13
output:
Draw
result:
ok single line: 'Draw'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 H1 H2 H3 H4 H5 H6 H7 D1 D2 D3 D4 D5 D6
output:
Draw
result:
ok single line: 'Draw'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 D12
output:
Draw
result:
ok single line: 'Draw'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3768kb
input:
S2 S4 S6 S8 S10 S12 H1 H3 H5 H7 H9 H11 H13 C1 C3 C5 C7 C9 C11 C13 D2 D4 D6 D8 D10 D12
output:
Draw
result:
wrong answer 1st lines differ - expected: 'Alice', found: 'Draw'