posts - 195,  comments - 30,  trackbacks - 0

In arithmetic we often use the scheme called 'round up by five' to round up a decimal fraction number into a decimal integer number whose fraction part equals to or is bigger than 0.5, otherwise, its fraction part is discarded.

In this problem, you are to implement a similar sheme called 'round up by six'.

Input

The first line of the input is an integer N indicating the number of cases you are to process. Then from the second line there are N lines, each containing a number (may or may not be fractional).

Output

For each number in the input, you are to print the round-up-by-six version of the number in a single line.

Sample Input

2
25.599
0.6

Sample Output

25
1
 
#include<iostream>
#include<cmath>
using namespace std;
int main()
{int n;
cin>>n;
while(n--)
{  double a;
cin>>a;
double b=floor(a);
if(a-b>=0.6)
cout<<b+1<<endl;
else
cout<<b<<endl;
}
return 0;
}
posted on 2009-07-03 00:56 luis 阅读(203) 评论(0)  编辑 收藏 引用 所属分类: 规律

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2011年2月>
303112345
6789101112
13141516171819
20212223242526
272812345
6789101112

常用链接

留言簿(3)

随笔分类

随笔档案

文章分类

文章档案

友情链接

搜索

  •  

最新评论

阅读排行榜

评论排行榜