Skip to content

Commit f9fbe1e

Browse files
committed
Added rideIsHere
1 parent 81648bb commit f9fbe1e

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

RideIsHere.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
USER: jack5551
3+
LANG: C++
4+
TASK: ride
5+
*/
6+
#include <fstream>
7+
using namespace std;
8+
ifstream fin("ride.in"); ofstream fout("ride.out");
9+
10+
int score(string s){
11+
int a = 1;
12+
for(int i = 0; i < s.length(); i++){
13+
a *= s[i] - 'A' + 1;
14+
}
15+
return a % 47;
16+
}
17+
18+
int main(){
19+
string comet, group;
20+
fin >> comet >> group;
21+
if(score(comet) == score(group)){
22+
fout << "GO\n";
23+
}
24+
else fout << "STAY\n";
25+
return 0;
26+
}

yourRideIsHere.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* USER: elijah1
3+
* TASK: ride
4+
* LANG: C++
5+
*/
6+
7+
#include <fstream>
8+
using namespace std;
9+
10+
ifstream fin("ride.in");
11+
ifstream fout("ride.out");
12+
13+
int score(string hello) {
14+
int a = 1
15+
for (int i = 0; i < hello.length(); i++) {
16+
//cout << hello[i] - 'A' + 1 << "\n";
17+
a *= hello[i] - 'A' + 1;
18+
}
19+
return a % 47;
20+
}
21+
22+
int main() {
23+
string comet, group;
24+
fin >> comet >> group;
25+
if (score(comet) == score(group)) {
26+
fout << "GO\n";
27+
}
28+
else fout << "STAY\n";
29+
return 0;
30+
}

0 commit comments

Comments
 (0)