您的位置:首页 > 其它

poj 3077 Rounders

2012-06-15 20:10 295 查看
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
int tc, len, i, ans, tmp;
string num;
cin >> tc;
while (tc--){
cin >> num;
len = num.length();
if (len == 1)
cout << num << endl;
else{
for (i = len - 1; i >= 0; i--){
tmp = num[i]-48;
if (tmp >= 5)
num[i-1]++;
}
len = num.length();
ans = (num[0]-48) * pow(10, float(len-1));
cout << ans << endl;
}
}

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