-
Notifications
You must be signed in to change notification settings - Fork 0
/
usaco-ride.c
54 lines (54 loc) · 927 Bytes
/
usaco-ride.c
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
/*
ID:zhongbi1
LANG:C
PROG:ride
*/
#include<stdio.h>
main()
{
FILE *fin=fopen("ride.in","r");
FILE *fout=fopen("ride.out","w");
int a=1,b=1;
int tmp,tmp2;
char *s1,*s2;
s1=(char *)malloc(sizeof(char)*7);
s2=(char *)malloc(sizeof(char)*7);
fscanf(fin,"%s %s",s1,s2);
/* for(tmp=0;tmp<6;tmp++)
{
if(s1[tmp!='\0'])
{
tmp2=s1[tmp]-64;//A's ascii value is 65
a*=tmp2;
}
if(s2[tmp]!='\0')
{
tmp3=s2[tmp]-64;
b*=tmp3;
}
}
*/
tmp=0;
while(s1[tmp]!='\0')
{
tmp2=s1[tmp]-64;//A's ascii value is 65
a *=tmp2;
tmp++;
printf("%d ",tmp2);
}
printf("\n");
tmp=0;
while(s2[tmp]!='\0')
{
tmp2=s2[tmp]-64;
b *=tmp2;
tmp++;
printf("%d ",tmp2);
}
printf("\n");
if(a%47==b%47)
fprintf(fout,"GO\n");
else
fprintf(fout,"STAY\n");
exit(0);
}