Skip to content

Commit 22b0803

Browse files
authored
Create FBMT.cpp
1 parent 3b4783a commit 22b0803

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Codeshef/FBMT.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int T;
6+
cin>>T;
7+
while(T--){
8+
int n;
9+
cin>>n;
10+
int a=0,b=0,temp=0;
11+
char team1[22]={},team2[22]={},tteam[22]={};
12+
for(int i=0;i<n;i++){
13+
cin>>tteam;
14+
if(i==0){
15+
for(int j=0;j<strlen(tteam);j++){
16+
team1[j]=tteam[j];
17+
}
18+
a++;
19+
}
20+
else{
21+
for(int j=0;j<strlen(tteam);j++){
22+
if(team1[j]==tteam[j]){
23+
temp=0;
24+
}
25+
else{
26+
temp=1;
27+
break;
28+
}
29+
}
30+
if(temp==0){
31+
a++;
32+
}
33+
else{
34+
for(int j=0;j<strlen(tteam);j++){
35+
team2[j]=tteam[j];
36+
}
37+
b++;
38+
}
39+
}
40+
}
41+
42+
if(a==b){
43+
cout<<"Draw"<<endl;
44+
}
45+
if(a>b){
46+
cout<<team1<<endl;
47+
}
48+
if(b>a){
49+
cout<<team2<<endl;
50+
}
51+
}
52+
return 0;
53+
}

0 commit comments

Comments
 (0)