Last active
September 27, 2018 15:31
-
-
Save tabvn/6a3a6778ad0a3320986b2ec3f16b6f4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdio.h> | |
| #include <iomanip> | |
| using namespace std; | |
| float gocTaoBoiKimGio(float gio){ | |
| float deg = 360 - (float)(30 * gio); | |
| return deg; | |
| } | |
| float gocTaoBoiKimPhut(int phut){ | |
| float d = (360/60) * phut; | |
| return d; | |
| } | |
| int main(){ | |
| float gio, phut; | |
| scanf("%f:%f", &gio, &phut); | |
| float h = gio + (float)phut/60; | |
| float goc = 360 - (gocTaoBoiKimGio(h) + gocTaoBoiKimPhut(phut)); | |
| // vi đề bài cho phép góc giữa 2 kim là nhỏ hơn 180 nên ta kiêm tra lan cuoi | |
| if(goc > 180){ | |
| goc = 360 - goc; | |
| } | |
| cout << fixed << setprecision(3) << goc; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment