শুক্রবার, ১৩ জানুয়ারী, ২০১৭

UVA 10683 - The decadary watch

#include<bits/stdc++.h>
using namespace std;
main()
{
    string s;
    while(cin>>s)
    {
        long long hr,mn,ans=0,rslt,sc,cc;
        hr=(s[0]-48)*10+(s[1]-48);
        mn=(s[2]-48)*10+(s[3]-48);
        sc=(s[4]-48)*10+(s[5]-48);
        cc=(s[6]-48)*10+(s[7]-48);
        ans=ans+hr*60*60*100;
        ans=ans+mn*60*100;
        ans=ans+sc*100;
        ans=ans+cc;
        rslt=(ans*10000000)/8640000;
    //In the normal system a day consists of 24 hrs.24hrs = 24 * 60 * 60 * 100 = 8640000 hs
    //in the decimal system a day consists of 10 dhrs.10 dhrs = 10 * 100 * 100 * 100 = 10000000 ds
         printf("%07lld\n", rslt);
    }
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন

Factorization with prime Sieve

vector <int> prime; char sieve[1000009]; int N=1000009; void primeSieve ( ) { sieve[0] = sieve[1] = 1; prime.push_back(2); ...