10 条题解

  • 4
    @ 2023-10-28 21:01:29
    #include <iostream>
    int main(){
        int q[6],a[6]={1,1,2,2,2,8};
        for(int i=0;i<6;i++)std::cin>>q[i];
        for(int i=0;i<6;i++)std::cout<<a[i]-q[i]<<" ";
        return 0;}
    
    • 3
      @ 2023-7-27 15:45:43

      使用数组存储每种棋子的正确数量,然后依次输入并做差即可。

      参考代码
      
      #include <bits/stdc++.h>
      using namespace std;
      int a[7] = {0, 1, 1, 2, 2, 2, 8}, x;
      int main()
      {
          for (int i = 1; i <= 6; i++) {
              cin >> x;
              cout << a[i] - x << " " ;
          }
          return 0;
      }
      
      • 1
        @ 2024-3-16 19:03:05
        #include <bits/stdc++.h>
        using namespace std;
        string s=" 112228";
        int x;
        int main(){
        	for (int i=1;i<=6;i++){scanf("%d",&x);printf("%d ",s[i]-'0'-x);}
        }
        
        • 0
          @ 2024-6-10 21:40:50
          # 菜题
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a[6];
              int b[6];
              int c[6];
              a[0]=1;
              a[1]=1;
              a[2]=2;
              a[3]=2;
              a[4]=2;
              a[5]=8;
              for (int i=0; i<6; i++)
              {
                  cin >>b[i];
              }
              for (int i=0; i<6; i++)
              {
                  if (b[i]<a[i])
                  {
                      c[i]=a[i]-b[i];
                  }
                  else
                  {
                      c[i]=a[i]-b[i];
                  }
              }
              for (int i=0; i<6; i++)
              {
                  cout <<c[i]<<" ";
              }
              return 0;
          }
          
          • 0
            @ 2024-6-9 16:18:11
            #include <bits/stdc++.h>//by hetao4185102
            using namespace std;
            int a, b, c, d, e, f;
            int main()
            {
            cin >> a >> b >> c >> d >> e >> f;
            if(a != 1) cout << 1 - a << " ";
            else cout << 0 << " ";
            if(b != 1) cout << 1 - b << " ";
            else cout << 0 << " ";
            if(c != 2) cout << 2 - c << " ";
            else cout << 0 << " ";
            if(d != 2) cout << 2 - d << " ";
            else cout << 0 << " ";
            if(e != 2) cout << 2 - e << " ";
            else cout << 0 << " ";
            if(f != 8) cout << 8 - f << " ";
            else cout << 0 << " ";
            return 0;
            }
            
            • 0
              @ 2024-6-9 16:15:49
              #include <bits/stdc++.h>//by hetao4185102
              using namespace std;
              int a, b, c, d, e, f;
              int main()
              {
              cin >> a >> b >> c >> d >> e >> f;
              if(a != 1) cout << 1 - a << " ";
              else cout << 0 << " ";
              if(b != 1) cout << 1 - b << " ";
              else cout << 0 << " ";
              if(c != 2) cout << 2 - c << " ";
              else cout << 0 << " ";
              if(d != 2) cout << 2 - d << " ";
              else cout << 0 << " ";
              if(e != 2) cout << 2 - e << " ";
              else cout << 0 << " ";
              if(f != 8) cout << 8 - f << " ";
              else cout << 0 << " ";
              return 0;
              }
              
              
              • 0
                @ 2024-1-28 21:21:27

                这代码只有前8行是有用的,水印爱要不要。欢迎白嫖(皮

                #include <bits/stdc^^.h>
                using namespace std;
                void ImW();
                int n,chess[7]={0,1,1,2,2,2,8},input[7];//这个你都看不懂你还是别学了
                signed main(void){
                    for(int i=1;i<=6;i++)    cin>>input[i];
                    for(int i=1;i<=6;i++)    cout<<chess[i]-input[i]<<' ';
                }
                void ImW()
                {
                    /*我是水印*/
                }
                
                • 0
                  @ 2023-11-21 12:52:47
                  #include <bits/stdc++.h>
                  using namespace std;
                  int x, b[10]{ 0, 1, 1, 2, 2, 2, 8 };
                  int main()
                  {
                      for (int i = 1; i <= 6; i++)
                      {
                          cin >> x;
                          cout << b[i] - x << " ";
                      }
                      return 0;
                  }
                  
                  • -2
                    @ 2024-4-13 13:30:39

                    这题很简单,暴力计算就好

                    #include <bits/stdc++.h>//by hetao4185102
                    using namespace std;
                    int a, b, c, d, e, f;
                    int main()
                    {
                    cin >> a >> b >> c >> d >> e >> f;
                    if(a != 1) cout << 1 - a << " ";
                    else cout << 0 << " ";
                    if(b != 1) cout << 1 - b << " ";
                    else cout << 0 << " ";
                    if(c != 2) cout << 2 - c << " ";
                    else cout << 0 << " ";
                    if(d != 2) cout << 2 - d << " ";
                    else cout << 0 << " ";
                    if(e != 2) cout << 2 - e << " ";
                    else cout << 0 << " ";
                    if(f != 8) cout << 8 - f << " ";
                    else cout << 0 << " ";
                    return 0;
                    }
                    
                    • -13
                      @ 2023-8-7 1:25:35

                      这个问题的解决思路是先计算出每种棋子需要添加或删除的数量,然后将结果输出。

                      对于国王和皇后,由于每套正确的棋子只能有一个,所以如果输入的数量大于1,则需要删除多余的棋子,即数量减去1。如果数量为0,则需要添加一个棋子,即1减去数量。

                      对于车、象和马,由于每套正确的棋子都需要两个,所以如果输入的数量大于2,则需要删除多余的棋子,即数量减去2。如果数量小于2,则需要添加缺少的棋子,即2减去数量。

                      对于兵,由于每套正确的棋子需要8个,所以如果输入的数量大于8,则需要删除多余的棋子,即数量减去8。如果数量小于8,则需要添加缺少的棋子,即8减去数量。

                      以上就是求解这个问题的思路,根据输入的棋子数量和上述规则,计算出每种棋子需要添加或删除的数量,并将结果输出。

                      #include <iostream>
                      
                      int main() {
                          int king, queen, rook, bishop, knight, pawn;
                          std::cin >> king >> queen >> rook >> bishop >> knight >> pawn;
                      
                          int missingKing = 1 - king;
                          int missingQueen = 1 - queen;
                          int missingRook = 2 - rook;
                          int missingBishop = 2 - bishop;
                          int missingKnight = 2 - knight;
                          int missingPawn = 8 - pawn;
                      
                          std::cout << missingKing << " " << missingQueen << " " << missingRook << " "
                                    << missingBishop << " " << missingKnight << " " << missingPawn << std::endl;
                      
                          return 0;
                      }
                      
                      • @ 2023-8-17 13:01:38
                        @[TomAnderson(UID: 105)](http://oj.hetao101.com/user/105)
                        

                        首先我质疑你这代码是否是自己写的

                        原因

                        我认为是Chat gpt

                        1.原因:你每个定义的东西都是完整的英文单词 实际上的选手并不会这么发

                        2.你这个用了std 实际上并不需要

                        我用此题查了一下chatgpt 发现代码如下
                        
                        #include <iostream>
                        
                        int main() {
                            int king, queen, rook, bishop, knight, pawn;
                            std::cin >> king >> queen >> rook >> bishop >> knight >> pawn;
                        
                            int missing_king = 1 - king;
                            int missing_queen = 1 - queen;
                            int missing_rook = 2 - rook;
                            int missing_bishop = 2 - bishop;
                            int missing_knight = 2 - knight;
                            int missing_pawn = 8 - pawn;
                        
                            std::cout << missing_king << " " << missing_queen << " "
                                      << missing_rook << " " << missing_bishop << " "
                                      << missing_knight << " " << missing_pawn << std::endl;
                        
                            return 0;
                        }
                        

                        image

                      • @ 2023-8-17 13:05:49

                        去了最后一句话其他一模一样 你有什么要解释的么?image

                      • @ 2023-8-17 13:06:55

                        /user/uid

                      • @ 2023-8-19 22:01:27

                        @ 不声明using namespace std的话要加上前面的std::

                      • @ 2023-11-18 10:42:01

                        你居然用ChatGPT写代码?差评!!!!

                      • @ 2023-11-18 10:43:33

                        我以前哼感激你写那么多题解的,现在我发现你的代码都是用ChatGPT写的,必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!必须差评!!!!!!!!!!!!!!!!!!!!

                      • @ 2023-11-26 11:23:45

                        @+1

                    • 1

                    信息

                    ID
                    355
                    时间
                    1000ms
                    内存
                    256MiB
                    难度
                    1
                    标签
                    (无)
                    递交数
                    386
                    已通过
                    293
                    上传者