题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4814
进制转换。
现场根据题目给的两个公式,不断更新!!!
胡搞就可以了。
现场3A,我艹,一次循环开大TLE,一次开小WA,太逗了,呵呵
现场源码:
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int a[];
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n;
while(scanf("%d",&n) == )
{
memset(a,,sizeof(a));
a[] = n;
for(int cc = ;cc <= ;cc++)
{
for(int i = ;i <= ;i++)
if(a[i] > && a[i+] > )
{
int MM = min(a[i],a[i+]);
a[i] -= MM;
a[i+] -= MM;
a[i+] += MM;
}
for(int i = ;i <= ;i++)
if(a[i] >= )
{
int pp = a[i]/;
a[i] %= ;
a[i+] += pp;
a[i-] += pp;
}
}
int st = ;
for(int i = ;i >= ;i--)
if(a[i] > )
{
st = i;
break;
}
int ed = ;
for(int i = ;i < ;i++)
if(a[i] > )
{
ed = i;
break;
}
for(int i = st;i >= ;i--)
{
printf("%d",a[i]);
}
if(ed < )printf(".");
for(int i = ;i >= ed;i--)
printf("%d",a[i]);
printf("\n");
}
return ;
}