Debashish_Saha

UVA 10683 The decadary watch

Feb 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     string s;
  6.     int hr,mnt,scnd,cc,total;
  7.     double ans,x,y;
  8.     x=24*60*60*100*1.0;
  9.     y=10*100*100*100*1.0;
  10.     while(cin>>s){
  11.         hr=(s[0]-'0')*10+(s[1]-'0');
  12.         mnt=(s[2]-'0')*10+(s[3]-'0');
  13.         scnd=(s[4]-'0')*10+(s[5]-'0');
  14.         cc=(s[6]-'0')*10+(s[7]-'0');
  15.         total=(hr*3600+mnt*60+scnd)*100+cc;
  16.         ans=total*(y/x);
  17.         printf("%07d\n",int(ans));
  18.  
  19.     }
  20.  
  21.     return 0;
  22. }
Add Comment
Please, Sign In to add comment