因为我看有些题解写的很丑陋,就把我的代码发上来。

第一题是我早期作品,丑陋不堪......

 1 #include <cstdio>
 2 #include <iostream>
 3 using namespace std;
 4 
 5 char a[10];
 6 char b[10];
 7 
 8 int pan(char c)
 9 {
10     if(c=='B') return 2;
11     if(c=='C') return 3;
12     if(c=='D') return 4;
13     if(c=='E') return 5;
14     if(c=='F') return 6;
15     if(c=='G') return 7;
16     if(c=='H') return 8;
17     if(c=='I') return 9;
18     if(c=='J') return 10;
19     if(c=='K') return 11;
20     if(c=='L') return 12;
21     if(c=='M') return 13;
22     if(c=='N') return 14;
23     if(c=='O') return 15;
24     if(c=='P') return 16;
25     if(c=='Q') return 17;
26     if(c=='R') return 18;
27     if(c=='S') return 19;
28     if(c=='T') return 20;
29     if(c=='U') return 21;
30     if(c=='V') return 22;
31     if(c=='W') return 23;
32     if(c=='X') return 24;
33     if(c=='Y') return 25;
34     if(c=='Z') return 26;
35     return 1;
36 }
37 
38 int xiuxi1()
39 {
40     int s=1;
41     for(int i=0;i<=9;i++)
42     {
43         s*=pan(a[i]);
44         s%=47;
45     }
46     return s;
47 }
48 
49 int xiuxi2()
50 {
51     int s=1;
52     for(int i=0;i<=9;i++)
53     {
54         s*=pan(b[i]);
55         s%=47;
56     }
57     return s;
58 
59 }
60 
61 int main()
62 {
63     cin>>a;
64     cin>>b;
65     //printf("xiuxi1:%d xiuxi2:%d\n",xiuxi1(),xiuxi2());
66     if(xiuxi1()==xiuxi2())
67     {
68         printf("GO");
69         return 0;
70     }
71     printf("STAY");
72     return 0;
73 }
P1200 代码在此

相关文章:

  • 2021-11-05
  • 2021-11-23
  • 2021-12-10
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-04
  • 2021-08-25
  • 2022-01-04
  • 2021-12-22
  • 2021-07-25
  • 2022-12-23
  • 2022-03-05
相关资源
相似解决方案