2 solutions

  • 2
    @ 2024-3-18 11:52:25

    #include #include

    using namespace std;

    string s,t;

    int calc(string s){ int res = 1; for (int i=0;i<s.length();i++) res *= (s[i]-'A'+1); return res % 47; }

    int main(){ cin >> s; cin >> t; if (calc(s) == calc(t)) cout << "GO"; else cout << "STAY"; }

    • 1
      @ 2024-3-18 15:35:03

      #include #include

      using namespace std;

      string s,t;

      int calc(string s){ int res = 1; for (int i=0;i < s.length(); i++) res *= s[i] -'A' + 1; return res % 47; }

      int main(){ cin >> s >> t;

      if ( calc(s) == calc(t) )
      	cout << "GO";
      else
      	cout << "STAY";
      

      }

      • 1

      Information

      ID
      200
      Time
      1000ms
      Memory
      125MiB
      Difficulty
      1
      Tags
      # Submissions
      50
      Accepted
      41
      Uploaded By