您的位置:首页 > 运维架构

topcoder ExerciseMachine

2015-09-04 13:39 399 查看
#include<iostream>

#include<string>

using namespace std;

int getPercentages(string time)

{
string h=time.substr(0,2);
string m=time.substr(3,2);
string s=time.substr(6,2);
int second=atoi(h.c_str())*3600+atoi(m.c_str())*60+atoi(s.c_str());
int count=second%100;
size_t i=1;
for(;i<100;++i)
{
if((count*i)%100==0)
break;
}
return 100/i-1;

}

int main()

{
string time("00:19:16");
cout<<getPercentages(time)<<endl;
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: