Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LTTS - chọn mốc thời gian gần hh:mm nhất mà có kim giờ trùng kim phút
- #include <iostream>
- using namespace std;
- int gio;
- int phut;
- int doigio(int h, int s)
- {
- return h * 60 + s;
- }
- int main()
- {
- cin>>gio;
- cin>>phut;
- float kq = (doigio(gio,phut) * (float)11 / 12) / 60;
- kq = floor(kq + 0.5) * (float)12 / 11;
- float temp = kq - floor(kq);
- cout << floor(kq) << "h" << floor(temp * 60 + 0.5)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement