1 条题解

  • 0
    @ 2025-3-3 16:33:58

    C :

    #include<stdio.h>
    void main(){
    	int t,k;
    	scanf("%d%d",&t,&k);
    	if(t==k){
    		printf("tie");
    	}else{
    		if(t==1 && k==2){
    			printf("win");
    		}else if(t==1 && k==3){
    			printf("lose");
    		}else if(t==2 && k==1){
    			printf("lose");
    		}else if(t==2 && k==3){
    			printf("win");
    		}else if(t==3 && k==1){
    			printf("win");
    		}else if(t==3 && k==2){
    			printf("lose");
    		}
    	}
    }
    

    C++ :

    #include<iostream>
    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"<<endl;
    	}else{
    		if(a==b){
    			cout<<"tie"<<endl;
    		}else{
    			cout<<"lose"<<endl;
    		}
    	
    	}
    	
    }
    

    Python :

    a,b = map(int,input().split());
    
    if b - a != 2:
        if a < b:
            print('win')
        elif a == b:
            print('tie')
        elif a - b == 2:
            print('win')
        else :
            print('lose')
    else:
        print('lose')
    
    
    
    
    • 1

    信息

    ID
    10821
    时间
    1000ms
    内存
    16MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者