1 条题解

  • 0
    @ 2024-12-18 14:07:30

    C :

    #include<stdio.h>
    
    int main()
    {
    	int A,B;
    	scanf("%d %d",&A,&B);
    	if(A>B)
    	{
    	    printf("O JOGO DUROU %d HORA(S)",24-A+B);
    	}
    	else if(A==B)
    	{
    	    printf("O JOGO DUROU %d HORA(S)",24);
    	}
    	else
    	{
    	    printf("O JOGO DUROU %d HORA(S)",B-A);
    	}
    
        return 0;
    }
    

    C++ :

    #include<iostream>
    
    using namespace std;
    
    int main()
    {
        int a,b;
        
        cin>>a>>b;
    
        if(a==b) cout<< "O JOGO DUROU 24 HORA(S)" <<endl; 
        
        if(a>b) cout<< "O JOGO DUROU " <<b+24-a<<" HORA(S)"<<endl;
        
        if(a<b) cout<< "O JOGO DUROU " << b-a << " HORA(S)" <<endl;
    
        return 0;
    }
    
    
    
    • 1

    信息

    ID
    655
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    提交数
    72
    已通过
    30
    上传者