TOJ 2577.Rounders
来源:互联网 发布:linux telnet连接拒绝 编辑:程序博客网 时间:2024/06/06 01:16
题目链接:http://acm.tju.edu.cn/toj/showp2577.html
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 1203 Accepted Runs: 789
Introduction:
For a given number, if greater than ten, round it to the nearest ten, then (if that result is greater than 100) take the result and round it to the nearest hundred, then (if that result is greater than 1000) take that number and round it to the nearest thousand, and so on ...
Input:
Input to this problem will begin with a line containing a single integer n indicating the number of integers to round. The next n lines each contain a single integer x (0 ≤ x ≤ 99999999).
Output:
For each integer in the input, display the rounded integer on its own line.
Note: Round up on fives.
Sample Input:
91514459912345678444444451445446
Sample Output:
20104510010000000500000002000500
Source: South Central USA 2006
水题,过之:
#include <stdio.h>using namespace std;int main(){int n,num;scanf("%d",&num);while(num--){int l,m;scanf("%d",&n);if(n<=10)printf("%d\n",n);else{for(l=0;(n/10)!=0;l++){int tmp=n;n/=10;if(tmp%10>=5)n++;}printf("%d",n);for(int i=0;i<l;i++)printf("0");printf("\n");}}}
0 0
- TOJ 2577.Rounders
- Rounders
- 1395. Rounders
- zoj2781------------------------Rounders
- POJ3077 Rounders
- o.boj 1120 Rounders
- zoj 2781 Rounders
- poj 3077 Rounders
- ZOJ 2781 Rounders
- poj 3077 Rounders(水题)
- poj 3077 Rounders
- Sicily 1395. Rounders
- POJ 3077 : Rounders
- ZOJ - 2781 Rounders
- ZOJ 2781-Rounders
- POJ 3077-Rounders
- POJ 3077 Rounders G++
- poj 3077 Rounders/bnuoj 3196 Rounders 解题报告
- php中中文字符串的截取和获取长度 mb_substr() mb_strlen()
- Android实现二维码的生成和扫描
- HDU 5489 Removed Interval(DP)
- Python PyInstaller命令
- Unity 控制摄像机跟随运动物体
- TOJ 2577.Rounders
- jQuery 之 (三)事件绑定、动画效果、封闭ajax、三级联动、插件
- 有关service
- 集群与分布式的区别
- LeetCode 11. Container With Most Water
- 单个参数在线调试
- Leetcode_19
- HttpUrlConnection和HttpClient
- 【读书笔记】《Effective Java》(3)-- 类和接口