54 条题解

  • 15
    @ 2023-6-25 8:46:16

    其实不用分那么多种,很容易漏,太绕了:

    #include <iostream>
    using namespace std;
    int main()
    {
        int t, k;  
        cin >> t >> k;
        if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1))
            cout << "win";
        else if (t == k)
            cout << "tie";
        else
            cout << "lose";
        return 0;
    }
    

    代码深度解析: 1,定义两个整形变量t和k,分别用来存储小T小K的出拳; 2,分三种结果判断,分别是小T胜、平局、小T败;

    3,当他们俩出拳是(1,2), (2,3), (3,1)时,输出win;

    4, 当他们出拳结果相同时,输出tie;

    5,其他情况,就都是小K胜,输出lose;

    绝对正确,放心搬运!

    先看解析,不看就黑你家

    如果有错误,欢迎大家指出🎉️

    看了就👍

    • @ 2023-7-30 10:00:43

    • @ 2023-7-30 10:01:24

      我没看**

    • @ 2023-7-30 10:04:33

      我想👎 行吗?

    • @ 2023-8-9 9:46:19

      应该是我黑你家

    • @ 2023-8-28 18:17:55

      @ 同上!!!!!!!!!!

    • @ 2023-8-30 12:54:49

      看看我的😄

      //挑战全网最简代码,不信你就试试看
      #include <iostream>
      using namespace std;
      int main()
      {
          cout << "lose";
          return 0;
      }
      
    • @ 2023-8-30 12:56:21

      还有谁👎

    • @ 2023-8-30 13:01:39

      @龚皓涵 赞同!!!!!!

    • @ 2024-2-3 15:53:27

      英雄所见一模一样,就是代码不一样:

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,m;
          cin >> n >> m;
          if ((n==1 && m==2) || (n==2 && m==3) || (n==3 && m==1))
          {
             cout << "win";
          }
          else if ((n==1 && m==1) || (n==2 && m==2) || (n==3 && m==3))//早知如此,我干嘛要写这么多,555。
          {
             cout << "tie";
          }
          else
          {
             cout << "lose";
          }
          return 0;
      }
      
    • @ 2024-2-3 15:55:12

      你妈****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

    • @ 2024-2-23 9:17:56

      就不点赞咋滴?

    • @ 2024-2-23 9:19:09

      我还要把赞倒过来(你懂得)@

    • @ 2024-3-23 17:21:00

      @ 6

    • @ 2024-3-23 17:21:33

      @huh

    • @ 2024-5-26 11:22:07

      这么6@

  • 1
    @ 2024-3-3 16:14:46
    #include <iostream>
    using namespace std;
    int main()
    {
        int a, b;
        cin >> a >> b;
        if (a != b)
        {
            if ((a == 1) && (b == 2))
            {
                cout << "win";
            }
            else if ((a == 2) && (b == 3))
            {
                cout << "win";
            }
            else if ((a == 3) && (b == 1))
            {
                cout << "win";
            }
            else
            {
                cout << "lose";
            }
        }
        else
        {
            cout << "tie";
        }
        return 0;
    }
    
    • 1
      @ 2024-2-12 14:46:16

      #include <iostream> using namespace std; int main() { int t, k; cin >> t >> k; if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1)) cout << "win"; else if (t == k) cout << "tie"; else cout << "lose"; return 0; }

      • 0
        @ 2023-12-10 11:59:31
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a,b;
            cin>>a>>b;
            if(a==1 and b==2)
            {
                cout<<"win";
            }
            else if(a==2 and b==3)
            {
                cout<<"win";
            }
            else if(a==3 and b==1)
            {
                cout<<"win";
            }
            else if(a==b)
            {
                cout<<"tie";
            }
            else
            {
                cout<<"lose";
            }
        }
        
        • 0
          @ 2023-11-22 20:04:39
          #include <iostream>
          using namespace std;
          int main()
          {
              int t, k;  
              cin >> t >> k;
              if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1))
                  cout << "win";
              else if (t == k)
                  cout << "tie";
              else
                  cout << "lose";
              return 0;
          }
          
          • 0
            @ 2023-11-5 19:05:53

            👍

            • -1
              @ 2024-5-20 21:28:48
              #include <bits/stdc++.h> 
              using namespace std;
              int main()
              {
                  int a,b;
                  cin>>a>>b;
                  if (a==1&&b==2||a==2&&b==3||a==3&&b==1)   
                  {
                      cout<<"win";  //小T赢的所有情况
                  }
                  else if (a==b)
                  {
                      cout<<"tie";  //平局
                  }
                  else
                  {
                      cout<<"lose";  //剩下只有输的情况
                  }
                  return 0;
              }
              
              • -1
                @ 2024-5-4 20:00:56
                using namespace std;
                int main()
                {
                int x,y;//x代表小T的出招,y代表小K的出招
                cin>>x>>y;
                if (x<y&&x!=1&&y!=3) cout<<"win";
                //通过观察我们可以发现,当x!=1且y!=3时,代表出招的编码较小的一方是胜者,因此,除掉特殊情况,只要小T的值小于小K的值,小T便赢了
                else if (x==1&&y==3) cout<<"win";
                //由于上步骤代码未包含小T出布、小K出石头的情况,便在这里特别考虑
                else if (x==y) cout<<"tie";
                else cout<<"lose";//只要不在上述两种情况中的,便都是小T输了
                return 0;
                }
                
                • @ 2024-5-4 20:02:36

                  寻找全网比我还简洁同时也能做到每个情况都考虑的代码!

              • -1
                @ 2024-4-13 20:50:10
                using namespace std;
                int main()
                {
                    int a, b;//定义
                    cin >> a >> b;//输入
                    if (a == b)//判断
                    {
                        cout << "tie";//输出
                    }
                    else if (a == 1)//判断
                    {
                        if (b == 2)//判断
                        {
                            cout << "win";//输出
                        }
                        else//判断
                        {
                            cout << "lose";//输出
                        }
                    }
                    else if (a == 2)//判断
                    {
                        if (b == 1)//判断
                        {
                            cout << "lose";//输出
                        }
                        else//判断
                        {
                            cout << "win";//输出
                        }
                    }
                    else if (a == 3)//判断
                    {
                        if (b == 1)//判断
                        {
                            cout << "win";//输出
                        }
                        else//判断
                        {
                            cout << "lose";//输出
                        }
                    }
                    return 0;//结束
                }
                
                
                • -1
                  @ 2024-3-18 20:58:47

                  python最简单 print("lose")

                  • -1
                    @ 2024-2-23 9:17:22

                    我直接用复制就不会错 `

                    #include <iostream>
                    using namespace std;
                    int main()
                    {
                        int a,b;
                        cin>>a>>b;    
                        if(a==1 && b==2)
                        {
                            cout<<"win";
                        }
                        if(a==2 && b==3)
                        {
                            cout<<"win";
                        }
                        if(a==3 && b==1)
                        {
                            cout<<"win";
                        }
                        if(a==2 && b==1)
                        {
                            cout<<"lose";
                        }
                        if(a==3 && b==2)
                        {
                            cout<<"lose";
                        }
                        if(a==1 && b==3)
                        {
                            cout<<"lose";
                        }
                        if(a==b)
                        {
                            cout<<"tie";
                        }
                        return 0;
                    }
                    
                    • -1
                      @ 2024-2-12 14:46:36

                      #include <iostream> using namespace std; int main() { int t, k; cin >> t >> k; if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1)) cout << "win"; else if (t == k) cout << "tie"; else cout << "lose"; return 0; }

                      • -1
                        @ 2024-2-12 14:45:46

                        #include <iostream> using namespace std; int main() { int t, k; cin >> t >> k; if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1)) cout << "win"; else if (t == k) cout << "tie"; else cout << "lose"; return 0; }

                        • -1
                          @ 2024-1-30 9:46:44
                          #include <iostream>
                          using namespace std;int main(){int t, k;  cin >> t >> k;if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1))cout << "win";else if (t == k)cout << "tie";else cout << "lose";}保证最短
                          
                          • -1
                            @ 2024-1-30 9:44:58
                            #include <iostream>
                            using namespace std;int main(){int t, k;  cin >> t >> k;if ((t == 1 && k == 2) || (t == 2 && k == 3) || (t == 3 && k == 1))cout << "win";else if (t == k)cout << "tie";else cout << "lose";}
                            
                            • -1
                              @ 2024-1-1 19:28:26

                              #include <iostream> using namespace std; int main() { int t,k; cin>>t>>k; if(t1&&k2||t2&&k3||t3&&k1) { cout<<"win"; } else if(k==t) { cout<<"tie"; } else { cout<<"lose"; } } 解题思路很简单,无需多讲。AC过了

                              • -1
                                @ 2024-1-1 17:13:46
                                //在上代码之前
                                //温馨提试:请使用(英国利息)输入法进行编程
                                #include <iostream>
                                using namespace std;
                                int main()//万能开头;
                                {
                                    int ABC,BAC;//我猜你一定想到了come的喂——你知道的
                                    
                                    cin>>ABC >>BAC;//输入他们
                                    if ((ABC==1&&BAC==1)||(ABC==2&&BAC==2)||(ABC==3&&BAC==3))
                                    {
                                        cout<<"tie";
                                        return 0;
                                    }
                                    if ((ABC==1&&BAC==2)||(ABC==2&&BAC==3)||(ABC==3&&BAC==1))
                                    {
                                        cout<<"win";
                                    }//注:win==胜利,这里为小T胜利!
                                    else
                                    {
                                        cout<<"lose";
                                    }//注:lose==丢失,这里为小K胜利;
                                }
                                
                                • -1
                                  @ 2024-1-1 12:29:53
                                  #include<bits/stdc++.h>
                                  using namespace std;
                                  int main()
                                  {
                                      int a,b;
                                      cin>>a>>b;
                                      if((a==1&&b==2)||(a==2&&b==3)||(a==3&&b==1))
                                      {
                                          cout<<"win";
                                      }
                                      else if(a==b)
                                      {
                                          cout<<"tie";
                                      }
                                      else
                                      {
                                          cout<<"lose";
                                      }
                                      return 0;
                                  }
                                  

                                  这个任务非常简单​,看题解的你会让小T失望哦

                                  • -1
                                    @ 2023-11-19 19:28:05
                                    #include<iostream>
                                    using namespace std;
                                    int main(){
                                    	int a,b;
                                    	cin>>a>>b;
                                    	if(a>b){
                                    		if(a-b==1){
                                    			cout<<"lose";
                                    		}
                                    		else{
                                    			cout<<"win";
                                    		}
                                    	}
                                    	
                                    	if(b>a){
                                    		if(b-a==1){
                                    			cout<<"win";
                                    		}
                                    		else{
                                    			cout<<"lose";
                                    		}
                                    	}
                                    	return 0;
                                    }
                                    
                                    • -1
                                      @ 2023-8-18 10:06:53

                                      已AC,放心复制(不得不说,Ctrl加CV太实用了)

                                      #include <iostream>
                                      using namespace std;
                                      int main()
                                      {
                                          int t,k;
                                          cin >> t >> k;
                                          if (t == 1 and k == 2 or t == 2 and k == 3 or t == 3 and k == 1)
                                          {
                                              cout << "win";
                                          }
                                          if (t == 1 and k == 1 or t == 2 and k == 2 or t == 3 and k == 3)
                                          {
                                              cout << "tie";
                                          } 
                                          if (t == 2 and k == 1 or t == 3 and k == 2 or t == 1 and k == 3)
                                          {
                                              cout << "lose";
                                          }
                                          return 0;
                                      }
                                      

                                      有大佬有更好的办法 欢迎指导!

                                      • @ 2023-8-18 10:09:01

                                        刚看了上面的方法,好像后两种结局我做的不节俭,还请大家见谅!

                                      • @ 2023-8-30 13:08:29

                                        前方高能!!!!! 天空一声巨响,大佬闪亮登场!!!!!!! #include <iostream> using namespace std; int main() { cout << "lose"; return 0; }

                                    信息

                                    ID
                                    43
                                    时间
                                    1000ms
                                    内存
                                    16MiB
                                    难度
                                    3
                                    标签
                                    递交数
                                    3667
                                    已通过
                                    1870
                                    上传者