-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1448.cpp
51 lines (49 loc) · 1011 Bytes
/
1448.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
// https://www.urionlinejudge.com.br/judge/en/problems/view/1448
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
int i,j,n,tam,tam1,tam2,errou1,errou2,test=1;
char frase[1002],frase1[1002],frase2[1002];
scanf("%d",&n);
scanf("%d\n");
for(i=0; i<n; i++){
tam1=tam2=0;
fgets(frase,1002,stdin);
fgets(frase1,1002,stdin);
fgets(frase2,1002,stdin);
tam=strlen(frase);
for(j=0; j<tam; j++){
if(frase1[j]==frase[j])
tam1++;
if(frase2[j]==frase[j])
tam2++;
}
printf("Instancia %d\n",test++);
if(tam1>tam2)
printf("time 1\n\n");
else if(tam2>tam1)
printf("time 2\n\n");
else{
errou1=0;
errou2=0;
for(j=0; j<tam; j++){
if(frase1[j]!=frase[j])
errou1++;
if(frase2[j]!=frase[j])
errou2++;
if(errou1 < errou2){
printf("time 1\n\n");
break;
}
else if(errou2<errou1){
printf("time 2\n\n");
break;
}
}
if(errou1==errou2)
printf("empate\n\n");
}
}
return 0;
}