-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathride.cpp
More file actions
41 lines (30 loc) · 658 Bytes
/
Copy pathride.cpp
File metadata and controls
41 lines (30 loc) · 658 Bytes
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
/*
ID: cl34nc0d3r
LANG: C++
TASK: ride
*/
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream fout("ride.out");
ifstream fin("ride.in");
const int magic = 47;
int group_mod, comet_mod;
string group_name = "";
string comet_name = "";
fin >> comet_name >> group_name;
int group_mul = 1;
int comet_mul = 1;
for (auto c : group_name)
{
group_mul *= int(c) - int('A') + 1;
}
for (auto c : comet_name)
{
comet_mul *= int(c) - int('A') + 1;
}
group_mul % magic == comet_mul % magic ? fout << "GO" << endl : fout << "STAY" << endl;
return 0;
}