Codeforces B. Barnicle
// Accepted
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define out(x) cout << x << "\n"
typedef unsigned long long ull;
string ans="";
void fun_ek(int n)
{
while(n--)
{
ans+="0";
}
}
int main()
{
fast;
string s;
while(cin >> s)
{
ans="";
if(s[0] != '0') ans+=s[0];
int b=0 , k=1;
string tmp="";
while(s[s.length()-k] != 'e')
{
tmp+=s[s.length()-k];
k++;
}
ull i=0 ;
//out(tmp);
//out(tmp.length());
k=0;
for(k=tmp.length()-1; k>=0; k--)
{
b = (tmp[k] - 48) + (b * 10);
}
//cout << "b = " << b << "\n";
//cout << s[s.length()-3] << "\n";
//cout << "len = " << s.length() << "\n";
bool f=false;
for(i=2; b > 0; i++, b--)
{
if(s[i] == 'e')
{
fun_ek(b);
f=true;
break;
}
ans+=s[i];
s[i] = '0';
}
//cout << ans << "\n";
//out(s);
//cout << "i = " << i << "\n";
//out(f);
if(s[i] == 'e') out(ans);
else
{
ans+=".";
ull z=0;
bool flg=false;
for(; i<=s.length()-tmp.length(); i++)
{
if(s[i] == 'e') break;
if(s[i] == '0') z++;
else z=0 , flg=true;
ans+=s[i];
}
//cout << ans << "\n";
if(!flg)
{
if(ans[0] == '.') out(0);
else if(ans[0] != '.') cout << ans[0] << "\n";
}
else
{
if(ans[0] == '.')
{
cout << "0" << ans << "\n";
}
else
{
cout << ans << "\n";
}
}
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define out(x) cout << x << "\n"
typedef unsigned long long ull;
string ans="";
void fun_ek(int n)
{
while(n--)
{
ans+="0";
}
}
int main()
{
fast;
string s;
while(cin >> s)
{
ans="";
if(s[0] != '0') ans+=s[0];
int b=0 , k=1;
string tmp="";
while(s[s.length()-k] != 'e')
{
tmp+=s[s.length()-k];
k++;
}
ull i=0 ;
//out(tmp);
//out(tmp.length());
k=0;
for(k=tmp.length()-1; k>=0; k--)
{
b = (tmp[k] - 48) + (b * 10);
}
//cout << "b = " << b << "\n";
//cout << s[s.length()-3] << "\n";
//cout << "len = " << s.length() << "\n";
bool f=false;
for(i=2; b > 0; i++, b--)
{
if(s[i] == 'e')
{
fun_ek(b);
f=true;
break;
}
ans+=s[i];
s[i] = '0';
}
//cout << ans << "\n";
//out(s);
//cout << "i = " << i << "\n";
//out(f);
if(s[i] == 'e') out(ans);
else
{
ans+=".";
ull z=0;
bool flg=false;
for(; i<=s.length()-tmp.length(); i++)
{
if(s[i] == 'e') break;
if(s[i] == '0') z++;
else z=0 , flg=true;
ans+=s[i];
}
//cout << ans << "\n";
if(!flg)
{
if(ans[0] == '.') out(0);
else if(ans[0] != '.') cout << ans[0] << "\n";
}
else
{
if(ans[0] == '.')
{
cout << "0" << ans << "\n";
}
else
{
cout << ans << "\n";
}
}
}
}
return 0;
}
Comments
Post a Comment