-
Notifications
You must be signed in to change notification settings - Fork 0
/
78_A.cpp
75 lines (68 loc) · 1.02 KB
/
78_A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<iostream>
#include<vector>
#include<sstream>
using namespace std;
string toString(int n)
{
stringstream s1;
s1<<n;
return s1.str();
}
string solve(string s1)
{
string ans;
int carry = 0;
int sum = s1[(int)s1.length()-1] - 48 + 1;
ans = toString((sum)%10) + ans;
carry = sum/10;
for(int i=(int)s1.length()-2;i>=0;i--)
{
sum = s1[i] - 48 + carry;
carry = sum/10;
ans = toString((sum%10)) + ans;
}
return ans;
}
int main()
{
string s;
cin>>s;
string intPart;
for(int i=0;i<(int)s.length();i++)
{
if(s[i]=='.')
break;
intPart+=s[i];
}
string doublePart;
bool startAdding = false;
for(int i=0;i<(int)s.length();i++)
{
if(s[i]=='.')
{
startAdding = true;
continue;
}
if(startAdding)
{
doublePart+=s[i];
}
}
if((intPart[(int)intPart.length()-1]-'0')%10==9)
{
cout<<"GOTO Vasilisa."<<endl;
}
else
{
int t = doublePart[0] - '0';
if(t<5)
{
cout<<intPart<<endl;
}
else
{
cout<<solve(intPart)<<endl;
}
}
return 0;
}