1 条题解

  • 0
    @ 2023-6-11 12:17:11

    C :

    #include <stdio.h>
    void main()
    {
    	int a ,b,c,d,e,f,g,h,min;
    	scanf("%d %d %d %d",&a, &b ,&c ,&d);
    	g=a*60+b;h=c*60+d;
    	min=h-g;
    	e=min/60;f=min-e*60;
    	printf("%d %d",e,f);
    	
    
    	
    	
    	
    } 
     
    

    C++ :

    #include <iostream>
    using namespace std;
    
    int main(){
    	int a,b,c,d;
    	cin>>a>>b>>c>>d;
    	int t1 = a * 60 + b;
    	int t2 = c * 60 + d;
    	
    	int t = t2 - t1;
    	cout<<t / 60<<" "<<t % 60<<endl;
    }
    

    Python :

    a,b,c,d=map(int,input().split())
    if d>=b:
        f=d-b
        e=c-a
    elif d<b:
        f=d+60-b
        e=c-1-a
    print(e,f)
    
    • 1

    信息

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