FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Programming/cplay.cpp at master · sudheerachary/Programming · GitHub
sudheerachary
/
Programming
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Programming
/
cplay.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (57 loc) · 1.51 KB
Breadcrumbs
Programming
/
cplay.cpp
Copy path
File metadata and controls
58 lines (57 loc) · 1.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
<
iostream
>
#
include
<
string
>
using
namespace
std
;
int
main
(
int
argc,
char
const
*argv[]) {
string s;
while
(cin>>s) {
int
a =
0
, b =
0
, r_a =
5
, r_b =
5
;
for
(
int
i =
0
; i <
20
; i++) {
if
(i <
10
) {
if
(i%
2
==
0
) {
a += s[i]-
'
0
'
;
r_a -=
1
;
}
else
{
b += s[i]-
'
0
'
;
r_b -=
1
;
}
if
(b>a+r_a) {
cout<<
"
TEAM-B
"
<<i+
1
<<endl;
break
;
}
if
(a>b+r_b) {
cout<<
"
TEAM-A
"
<<i+
1
<<endl;
break
;
}
}
else
{
if
(i%
2
==
0
)
a += s[i]-
'
0
'
;
else
{
b += s[i]-
'
0
'
;
if
(a > b) {
cout<<
"
TEAM-A
"
<<i+
1
<<endl;
break
;
}
if
(b > a) {
cout<<
"
TEAM-B
"
<<i+
1
<<endl;
break
;
}
}
}
if
(i ==
9
) {
if
(a > b) {
cout<<
"
TEAM-A
"
<<i+
1
<<endl;
break
;
}
if
(b > a) {
cout<<
"
TEAM-B
"
<<i+
1
<<endl;
break
;
}
}
}
if
(a == b)
cout<<
"
TIE
"
<<endl;
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL