4 条题解

  • 1
    @ 2025-12-21 20:54:41
    #include<iostream>
    #include<cstdio>
    #include<cctype>
    #include<string.h>
    #include<math.h>
    #include<cmath>
    #include<algorithm>
    #include<iomanip>
    using namespace std;
    int main()
    {
    	int a,b,c,d;
    	cin>>a>>b>>c>>d;
    	if(d<b)
    	{
    		cout<<c-a-1<<" "<<d+60-b;
    	 } 
    	else
    	{
    		cout<<c-a<<" "<<d-b;
    	}
    	return 0;
    }
    
    
    
    • 1
      @ 2025-2-10 17:53:53

      最短

      #include<bits/stdc++.h>
      #define long long int 
      using namespace std;
      const int N=1e5+5,INF=0x3f3f3f3f;
      int a,b,c,d;
      int main()
      {
      	cin>>a>>b>>c>>d;
      	cout<<(c*60+d-a*60-b)/60<<" "<<(c*60+d-a*60-b)%60;
      	return 0;
      }
      

      ACcode

      • 0
        @ 2024-6-1 14:16:03

        两种情况,判断一下d<b时的情况

        #include<bits/stdc++.h>
        using namespace std;
        int a,b,c,d;
        int main(){
        	cin>>a>>b>>c>>d;
        	if(c>=a&&d>=b) cout<<c-a<<" "<<d-b;
        	else cout<<c-a-1<<" "<<d+60-b;
        }
        
        • -1
          @ 2024-6-19 20:20:34

          #include using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int t=c60+d-a60-b; cout<<t/60<<" "<<t%60; return 0; } #思考

          • 1

          信息

          ID
          3148
          时间
          1000ms
          内存
          256MiB
          难度
          3
          标签
          递交数
          488
          已通过
          246
          上传者