Advertisement
fahad005

cin, cout

Jun 29th, 2021
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. /*
  2. ID: fahadpa1
  3. TASK: ride
  4. LANG: C++14
  5. */
  6.  
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. //
  10. #define ll long long
  11. #define ull unsigned long long
  12. #define mx 100010
  13. #define mod 1000000007
  14. #define inf INT_MAX
  15. #define pi acos(-1)
  16. #define endl '\n'
  17. #define pb push_back
  18. #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
  19. //
  20. int main() {
  21.     ofstream cout ("ride.out");
  22.     ifstream cin ("ride.in");
  23.  
  24.     string str, str1;
  25.     cin >> str >> str1;
  26.  
  27.     int x = 1, y = 1;
  28.     for (int i = 0; i < str.length(); i++) {
  29.         x = ((x % 47) * ((str[i] - 'A' + 1) % 47)) % 47;
  30.     }
  31.     for (int i = 0; i < str1.length(); i++) {
  32.         y = ((y % 47) * ((str1[i] - 'A' + 1) % 47)) % 47;
  33.     }
  34.  
  35.     if (x == y) cout << "GO" << endl;
  36.     else cout << "STAY" << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement