1 solutions

  • 0
    @ 2025-3-3 16:33:39

    C :

    #include<stdio.h>
    main() {
    	int n,x,a,c,d,e;
    	double m;
    	char b;
    	scanf("%d%c%d\n",&a,&b,&c);
    	scanf("%d%c%d",&d,&b,&e);
    	if(b==':') {
    		if(a==d) {
    			n=e-c;
    			m=0.5*n;
    			printf("%.1f\n",m);
    		}
    		if(a<d) {
    			n=60-c+e;
    			m=0.5*n;
    			printf("%.1f\n",m);
    		}
    	}
    
    }
    

    C++ :

    #include<iostream> 
    #include<string>
    #include<iomanip>
    using namespace std;
    int main() 
    {
    	string a, b;
    	cin >> a >> b;
    	double deg = ((b[0] - '0') * 600 + (b[1] - '0') * 60 + (b[3] - '0') * 10 + (b[4] - '0') - (a[0] - '0') * 600 - (a[1] - '0') * 60 - (a[3] - '0') * 10 - (a[4] - '0')) * 0.5;
    	cout << fixed << setprecision(1) << deg << endl;
    	return 0;
    }
    

    Python :

    a,b=list(map(int,input().split(":")))
    c,d=list(map(int,input().split(":")))
    t=c*30+(30*d/60)-(a*30+(30*b/60))
    print("%.1lf"%t)
    
    
    • 1

    Information

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