File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments