#17518: 給延平的同仁 c++ AC


089487 (089487)

學校 : 國立臺灣師範大學附屬高級中學
編號 : 82069
來源 : [220.130.10.185]
最後登入時間 :
2024-04-01 11:16:18
d095. 00579 - ClockHands -- UVa579 | From: [42.72.109.51] | 發表日期 : 2019-04-17 13:12

#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b;
while(scanf("%lf:%lf",&a,&b)==2)
{
if(a==0&&b==0) break;
a=(a*30)+b/12*6;
b*=6;
if(abs(a-b)>180) printf("%.3f\n",360-abs(a-b));
else printf("%.3f\n",abs(a-b));
}
}

 AC (3ms, 352KB)

 
#17525: Re:給延平的同仁 c++ AC


ufve0704 (爬 我爬 我爬爬爬 有排行榜這種東西就是要爬 爬過我上面的那...)

學校 : 臺北市私立延平高級中學
編號 : 83268
來源 : [203.72.178.1]
最後登入時間 :
2023-10-30 13:02:50
d095. 00579 - ClockHands -- UVa579 | From: [114.42.219.181] | 發表日期 : 2019-04-17 19:51

#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b;
while(scanf("%lf:%lf",&a,&b)==2)
{
if(a==0&&b==0) break;
a=(a*30)+b/12*6;
b*=6;
if(abs(a-b)>180) printf("%.3f\n",360-abs(a-b));
else printf("%.3f\n",abs(a-b));
}
}

 AC (3ms, 352KB)


小改:

#include<bits/stdc++.h>

using namespace std;

int main(){

double a,b;

while(scanf("%lf:%lf",&a,&b)==2&&a+b!=0){

a=(a*30)+b/12*6;

b*=6;

if(abs(a-b)>180) printf("%.3f\n",360-abs(a-b));

else printf("%.3f\n",abs(a-b));

}

}

AC (3ms, 348KB)
 
ZeroJudge Forum