diff options
Diffstat (limited to '1.2/ride.c')
-rw-r--r-- | 1.2/ride.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/1.2/ride.c b/1.2/ride.c new file mode 100644 index 0000000..2a68239 --- /dev/null +++ b/1.2/ride.c @@ -0,0 +1,32 @@ +/* +ID: mytbk921 +LANG: C +TASK: ride +*/ + +#include <stdio.h> +#define MODN 47 + +int main() +{ + FILE *fin=fopen("ride.in","r"); + FILE *fout=fopen("ride.out","w"); + int p[2]={1,1}; //2 products + char str[2][8]; + + int i,j; + fscanf(fin,"%s%s",str[0],str[1]); + for (i=0;i<2;i++){ + for (j=0;str[i][j];j++){ + p[i]*=str[i][j]-'A'+1; + p[i]%=MODN; + } + } + if (p[0]==p[1]) + fprintf(fout,"GO\n"); + else + fprintf(fout,"STAY\n"); + + return 0; +} + |