//
// main.cpp
// 10683 - The decadary watch
// Created by Panks on 28/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include <sstream>
using namespace std;
long double mult = 10000000.0/8640000.0;
long long int secs1;
int ans;
string convertInt(int number);
string convertInt(int number)
{
stringstream ss; //create a stringstream
ss << number; //add number to the stream
return ss.str(); //return a string with the contents of the stream
}
int main (int argc, const char * argv[])
{
string input;
int h1, m1, s1, c1, h2, m2, s2, c2;
while (getline(cin, input)) {
h1=(input[0]-'0')*10+(input[1]-'0');
m1=(input[2]-'0')*10+(input[3]-'0');
s1=(input[4]-'0')*10+(input[5]-'0');
c1=(input[6]-'0')*10+(input[7]-'0');
secs1=h1*360000+m1*6000+s1*100+c1;
ans=secs1*mult;
string tocheck=convertInt(ans);
int len=7-(tocheck.size());
while (len--) {
cout<<'0';
}
cout<<ans<<endl;
}
return 0;
}
Saturday, June 2, 2012
10683 - The decadary watch
Labels:
Ad Hoc,
programming,
solution,
source,
The decadary watch,
UVa
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment