USACO Section 1.1: Your Ride Is Here

 1 /*

 2 ID: leetcod3

 3 PROG: ride

 4 LANG: C++

 5 */

 6 #include <iostream>

 7 #include <fstream>

 8 #include <string>

 9 #include <map>

10 #include <vector>

11 #include <set>

12 #include <algorithm>

13 #include <stdio.h>

14 #include <queue>

15 #include <cstring>

16 #include <cmath>

17 #include <list>

18 #include <cstdio>

19 #include <cstdlib>

20 #include <limits>

21 #include <stack>

22 

23 using namespace std;

24 

25 ofstream fout ("ride.out");

26 ifstream fin ("ride.in");

27 

28 int main() {

29     string a, b;

30     fin >> a >> b;

31     int i1 = 1;

32     int i2 = 1;

33     for (int i = 0; i < a.size(); i++) {

34         i1 *= (a[i] - 'A' + 1);

35     }

36     for (int i = 0; i < b.size(); i++) {

37         i2 *= (b[i] - 'A' + 1);

38     }

39     if (i1 % 47 == i2 % 47) fout << "GO" << endl;

40     else fout << "STAY" << endl;

41     return 0;

42 }

 

你可能感兴趣的:(USACO)