1 条题解

  • 0
    @ 2023-6-11 12:16:43

    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

    信息

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