6 条题解

  • 6
    @ 2022-2-26 10:02:09
    #include <queue> 
    #include <math.h> 
    #include <stack> 
    #include <stdio.h>
    #include <iostream>
    #include <vector> 
    #include <iomanip> 
    #include <string.h> 
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10; 
    const int INF = 0x3f3f3f3f; 
    char a[N],b[N];
    int main() 
    { 
        cin >> a >> b;
        int lena = strlen(a);
        int lenb = strlen(b);
        int sum1,sum2;
        sum1 = sum2 = 1;
        for(int i = 0;i < lena;i++)
        {
            sum1 = (sum1*(a[i]-'A'+1)) %47;
        }
        for(int j=0;j<lenb;j++)
        {
            sum2 = (sum2*(b[j]-'A'+1)) %47;
        }
        if(sum1==sum2)
        {
            cout<<"GO" <<endl <<"r1=" << "r2=" <<sum1;
        }
        else
        {
            cout<<"STAY"<<endl<<"r1="<<sum1<<" "<<"r2="<<sum2;
        }
        return 0;
    }
    
    
    • 4
      @ 2022-2-26 10:01:41
      #include <queue> 
      #include <math.h> 
      #include <stack> 
      #include <stdio.h>
      #include <iostream>
      #include <vector> 
      #include <iomanip> 
      #include <string.h> 
      #include <algorithm>
      using namespace std;
      #define LL long long
      const int N = 1e5 + 10; 
      const int INF = 0x3f3f3f3f; 
      char a[N],b[N];
      int main() 
      { 
          cin >> a >> b;
          int lena = strlen(a);
          int lenb = strlen(b);
          int sum1,sum2;
          sum1 = sum2 = 1;
          for(int i = 0;i < lena;i++)
          {
              sum1 = (sum1*(a[i]-'A'+1)) %47;
          }
          for(int j=0;j<lenb;j++)
          {
              sum2 = (sum2*(b[j]-'A'+1)) %47;
          }
          if(sum1==sum2)
          {
              cout<<"GO" <<endl <<"r1=" << "r2=" <<sum1;
          }
          else
          {
              cout<<"STAY"<<endl<<"r1="<<sum1<<" "<<"r2="<<sum2;
          }
          return 0;
      }
      
      • 3
        @ 2022-2-26 9:53:40
        #include <iostream>
        #include <stdio.h>
        #include <string.h>
        using namespace std;
        char a[100000],b[1000000];
        int main()
        {
        	cin>>a>>b;
        	int lena=strlen(a);
        	int lenb=strlen(b);
        	int sum1,sum2;
        	sum1=sum2=1;
        	for(int i=0;i<lena;i++)
        	{
        		sum1=(sum1*(a[i]-'A'+1))%47;
        	}
        	for(int j=0;j<lenb;j++)
        	{
        		sum2=(sum2*(b[j]-'A'+1))%47;
        	}
        	if(sum1==sum2)
        	{
        		cout<<"GO"<<endl<<"r1="<<"r2="<<sum1;
        	}
        	else
        	{
        		cout<<"STAY"<<endl<<"r1="<<sum1<<" "<<"r2="<<sum2;
        	}
        	return 0;
        }
        
        • 1
          @ 2022-2-26 9:53:35
          #include <iostream>
          #include <stdio.h>
          #include <string.h>
          using namespace std;
          char a[100000],b[1000000];
          int main()
          {
          	cin>>a>>b;
          	int lena=strlen(a);
          	int lenb=strlen(b);
          	int sum1,sum2;
          	sum1=sum2=1;
          	for(int i=0;i<lena;i++)
          	{
          		sum1=(sum1*(a[i]-'A'+1))%47;
          	}
          	for(int j=0;j<lenb;j++)
          	{
          		sum2=(sum2*(b[j]-'A'+1))%47;
          	}
          	if(sum1==sum2)
          	{
          		cout<<"GO"<<endl<<"r1="<<"r2="<<sum1;
          	}
          	else
          	{
          		cout<<"STAY"<<endl<<"r1="<<sum1<<" "<<"r2="<<sum2;
          	}
          	return 0;
          }
          
          • 0
            @ 2023-5-23 22:22:09
            • #include<bits/stdc++.h>
              using namespace std;
              char s1[1145],s2[1145];
              long long r1=1,r2=1;
              int main()
              {
                  cin>>s1>>s2;
                  for(int i=0;i<strlen(s1);i++)r1=(s1[i]-64)*r1%47;
                  for(int i=0;i<strlen(s2);i++)r2=(s2[i]-64)*r2%47;
                  if(r1==r2)
                  {
                      cout<<"GO\nr1=r2="<<r1;
                  }
                  else cout<<"STAY\nr1="<<r1<<" r2="<<r2;
                  return 0;
              }
              

              Copy

            • 0
              @ 2023-4-6 19:16:00
              #include<iostream>
              #include<cstring>
              using namespace std;
              char s1[1145],s2[1145];
              long long r1=1,r2=1;
              int main()
              {
                  cin>>s1>>s2;
                  for(int i=0;i<strlen(s1);i++)r1=(s1[i]-64)*r1%47;
                  for(int i=0;i<strlen(s2);i++)r2=(s2[i]-64)*r2%47;
                  if(r1==r2)
                  {
                      cout<<"GO\nr1=r2="<<r1;
                  }
                  else cout<<"STAY\nr1="<<r1<<" r2="<<r2;
                  return 0;
              }
              
              • 1

              信息

              ID
              1085
              时间
              1000ms
              内存
              128MiB
              难度
              7
              标签
              递交数
              592
              已通过
              151
              上传者