11 条题解

  • 2
    @ 2024-2-27 13:12:25
    #include<bits/stdc++.h>
    using namespace std;
    int a,b,c,d;
    int main(){
    	cin>>a>>b>>c>>d;
    	int e=(c-a)*60+d-b;
    	cout<<e/60<<" "<<e%60;
    	return 0;
    }
    
    • 1
      @ 2023-10-2 16:11:34
      #include<iostream>
      using namespace std;
      int main(){
          int h1,h2,m1,m2;
          cin >> h1 >> m1 >> h2 >> m2;
          int h=h2-h1;
          int m = m2-m1;
          if(m<0){
              m+=60;
              h-=1;
          }else if (m==60) {
              m=0;
              h+=1;
          }
          cout << h << ' ' << m;
          return 0;
      }
      
      • 1
        @ 2023-9-9 9:14:35
        #include <iostream>
        using namespace std;
        int main(){
            int a,b,c,d,num,min,h;
            cin >> a >> b >> c >> d;
            min = d - b;
            num = (c * 60) - (a * 60) + min;
            h = num / 60;
            min = num % 60;
            cout<< h << " " << min << endl;
            return 0;
        }
        
        • 1
          @ 2023-9-2 16:57:56
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
          	int a,b,c,d,e,f;
          	cin>>a>>b>>c>>d;//12 50 19 10
          	if(a==c)
          	{
          		cout<<"0"<<" "<<d-b<<endl;
          	}
          	else if(c>a)
          	{
          		if(b>d)//50>10
          		{
          			e=c-a-1;//6
          			f=d+60-b;//20
          			cout<<e<<" "<<f<<endl;
          		}
          		else
          		{
          			e=c-a;
          			f=d-b;
          			cout<<e<<" "<<f<<endl;
          		}
          	}
          	else
          	{
          		return 0;
          	}
          	return 0;
          }
          
          • 1
            @ 2023-5-9 19:23:05
            #include<iostream>
            using namespace std;
            int main() {
                int a, b, c, d, e, f, sum1, sum2, time;
                cin >> a >> b >> c >> d;
                sum1 = a * 60 + b;
                sum2 = c * 60 + d;
                time = sum2 - sum1;
                e = time / 60;
                f = time % 60;
                cout << e << " " << f;
                return 0;
            }
            
            • 0
              @ 2024-3-24 7:52:42
              #include <iostream>#include<cmath>#include<cstdio>using namespace std;int main(){int a,b,c,d;cin>>a>>b>>c>>d;if(b>d)cout<<c-a-1<<" "<<d+60-b;elsecout<<c-a<<" "<<d-b;return 0;}
              
              • 0
                @ 2023-8-17 15:15:14
                #include <iostream>
                using namespace std;
                int main()
                {
                    int a,b,c,d;
                    cin>>a>>b>>c>>d;
                    int x=c-a,y=d-b;
                    if(y<0){x--;y+=60;}
                    cout<<x<<" "<<y;
                    return 0;
                }
                
                • 0
                  @ 2023-4-12 7:09:04

                  全部化为分钟计算

                  #include<bits/stdc++.h>
                  using namespace std;
                  int main() {
                      int a,b,c,d;
                      cin>>a>>b>>c>>d;
                      b+=a*60;
                      d+=c*60;
                      int f=d-b;
                      int e=f/60;
                      f-=e*60;
                      cout<<e<<' '<<f;
                      return 0;
                  }
                  
                  • 0
                    @ 2022-6-5 10:12:45
                    #include<cstdio>
                    using namespace std;
                    int main()
                    {
                    	int a,b,c,d;
                    	scanf("%d %d %d %d",&a,&b,&c,&d);
                    	int e=(c-a)*60+d-b;
                    	printf("%d %d",e/60,e%60);
                    	return 0;
                    }
                    
                    • 0
                      @ 2022-5-18 22:03:35

                      `

                      #include <bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                      	int a , b , c , d , e , f ;
                      	cin >> a >> b >> c >> d ;
                      	e = c - a ;
                      	f = d - b ;
                      	if (f < 0){
                      		e = e - 1 ;
                      		f = f + 60 ;
                      	}
                      	cout << e << " " << f ;
                      	return 0 ;
                      }
                      
                      • -2
                        @ 2021-11-6 17:18:49

                        #include <iostream>

                        using namespace std;

                        int a,b,c,d;

                        int main()

                        {

                        cin>>a>>b>>c>>d;
                        
                        int s=c-a,f=d-b;
                        
                        if(f<0)
                        
                        {
                        
                        s--;f+=60;
                        
                        }
                        
                        cout<<s<<" "<<f;
                        
                        return 0;
                        

                        }

                        • 1

                        信息

                        ID
                        425
                        时间
                        1000ms
                        内存
                        125MiB
                        难度
                        1
                        标签
                        递交数
                        427
                        已通过
                        290
                        上传者