1 solutions

  • 0
    @ 2025-3-3 16:32:53

    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

    Information

    ID
    10458
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By