1 条题解

  • 0
    @ 2023-6-11 12:20:43

    C :

    #include<string.h>
    #include<stdio.h>
    int main()
    {
        int m;
        scanf("%d",&m);
         if(m==1)
             printf("swim");
           if(m==3)
               printf("program");
           if(m==5)
               printf("read");
          if(m==6)
                      printf("math");
        if(m==2||m==4||m==7)
            printf("rest");
        return 0;
    }
    

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;
    	cin>>n;
    	if(n == 1){
    		cout<<"swim";
    	}else if(n == 3){
    		cout<<"program";
    	}else if(n == 5){
    		cout<<"read";
    	}else if(n == 6){
    		cout<<"math";
    	}else{
    		cout<<"rest";
    	}
    }
    
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Scanner sc = new Scanner(System.in);
    		int n = sc.nextInt();
    		if(n == 1){
    			System.out.println("swim");
    		}else if(n == 3){
    			System.out.println("program");
    		}else if(n == 5){
    			System.out.println("read");
    		}else if(n == 6){
    			System.out.println("math");
    		}else{
    			System.out.println("rest");
    		}
    		sc.close();
    	}
    
    }
    

    Python :

    n = int(input())
    if n == 1:
        print('swim')
    elif n == 3:
        print('program')
    elif n == 5:
        print('read')
    elif n == 6:
        print('math')
    else:
        print('rest')
    
    
    • 1

    信息

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