Advertisement
XuanHong

LTTS - chọn mốc thời gian gần hh:mm nhất...

Feb 2nd, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1.  
  2. // LTTS - chọn mốc thời gian gần hh:mm nhất mà có kim giờ trùng kim phút
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int gio;
  8. int phut;
  9.  
  10. int doigio(int h, int s)
  11. {
  12.     return h * 60 + s;
  13. }
  14.  
  15. int main()
  16. {
  17.     cin>>gio;
  18.     cin>>phut;
  19.     float kq = (doigio(gio,phut) * (float)11 / 12) / 60;
  20.     kq = floor(kq + 0.5) * (float)12 / 11;
  21.     float temp = kq - floor(kq);
  22.     cout << floor(kq) << "h" << floor(temp * 60 + 0.5)<<endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement