您的位置:首页 > 其它

浙大PAT 1058

2016-02-28 13:15 387 查看
//水水的题目

#include<iostream>

#include<fstream>

#include<algorithm>

#include<vector>

#include<stack>

#include<queue>

#include<math.h>

#include<string>

using namespace std;

 

//#define fin cin  

int main()  

{  

/*ifstream fin("d:\in.txt" ); 
if (! fin.is_open())  

cout << "Error opening file";
system("pause");
exit (1); 
}*/
int g1=0,s1=0,k1=0,g2=0,s2=0,k2=0;
string a,b;
cin>>a>>b;
int i=0;
while(a[i]!='.')
{
g1=g1*10+a[i]-48;
i++;
}
i++;
while(a[i]!='.')
{
s1=s1*10+a[i]-48;
i++;
}
i++;
while(i<a.size())
{
k1=k1*10+a[i]-48;
i++;
}

i=0;
while(b[i]!='.')
{
g2=g2*10+b[i]-48;
i++;
}
i++;
while(b[i]!='.')
{
s2=s2*10+b[i]-48;
i++;
}
i++;
while(i<b.size())
{
k2=k2*10+b[i]-48;
i++;
}
int jw=0;
if(k1+k2>=29)
{
jw=1;
k1=k1+k2-29;
}
else
{
k1=k1+k2;
}
if(s1+s2+jw>=17)
{
s1=s1+s2+jw-17;
jw=1;
}
else
{
s1=s1+s2+jw;
jw=0;
}
g1=g1+g2+jw;
cout<<g1<<'.'<<s1<<'.'<<k1;

system("PAUSE");  

    return 0;  

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