-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathZOJ1057(AC).cpp
83 lines (72 loc) · 958 Bytes
/
ZOJ1057(AC).cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;
int main()
{
int a[1000];
int b[1000];
int sca;
int scb;
int n;
int i;
int casecount;
casecount = 0;
while(true)
{
if(scanf("%d", &n) != 1)
{
break;
}
else
{
if(n == 0)
{
break;
}
casecount++;
if(casecount > 1)
{
printf("\n");
}
}
for(i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
for(i = 0; i < n; i++)
{
scanf("%d", &b[i]);
}
sca = 0;
scb = 0;
for(i = 0; i < n; i++)
{
if(a[i] == 1 && b[i] == 2)
{
sca += 6;
}
else if(b[i] == 1 && a[i] == 2)
{
scb += 6;
}
else if(a[i] - b[i] > 1)
{
sca += a[i];
}
else if(a[i] - b[i] == 1)
{
scb += a[i] + b[i];
}
else if(b[i] - a[i] > 1)
{
scb += b[i];
}
else if(b[i] - a[i] == 1)
{
sca += a[i] + b[i];
}
}
printf("A has %d points. B has %d points.\n", sca, scb);
}
return 0;
}