POJ 3077-Rounders(水题乱搞)
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 7697 | Accepted: 4984 |
Description
and so on ...
Input
Output
Note: Round up on fives.
Sample Input
9
15
14
4
5
99
12345678
44444445
1445
446
Sample Output
20
10
4
5
100
10000000
50000000
2000
500
题意:给一个数字。然后从最后一位開始进位,满5进1。小于5变成0。比方 12345 -> 12350->12400->12000->10000;
暴力乱搞即可了。 。
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cctype>
#include <vector>
#include <cstdio>
#include <cmath>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define ll long long
#define maxn 116
#define pp pair<int,int>
#define INF 0x3f3f3f3f
#define max(x,y) ( ((x) > (y)) ? (x) : (y) )
#define min(x,y) ( ((x) > (y)) ? (y) : (x) )
using namespace std;
int x;
char s[15];
void solve()
{
sprintf(s,"%d",x);
for(int i=strlen(s)-1;i>0;i--)
{
if(s[i]>='5')
{
s[i]='0';
s[i-1]++;
}
else
s[i]='0';
}
if(s[0]>'9'){s[0]='0';printf("1");}
puts(s);
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%d",&x);
if(x<=10){printf("%d\n",x);continue;}
solve();
}
return 0;
}
POJ 3077-Rounders(水题乱搞)的更多相关文章
- Codeforces Gym 100431D Bubble Sort 水题乱搞
原题链接:http://codeforces.com/gym/100431/attachments/download/2421/20092010-winter-petrozavodsk-camp-an ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- POJ 3077 : Rounders
Rounders Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7827 Accepted: 5062 Description ...
- poj 3264 RMQ 水题
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...
- Poj 1552 Doubles(水题)
一.Description As part of an arithmetic competency program, your students will be given randomly gene ...
- 最小费用最大流模板 poj 2159 模板水题
Going Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15944 Accepted: 8167 Descr ...
- POJ 1837 Balance 水题, DP 难度:0
题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物 ...
- POJ - 3090 gcd水题
大概题意就是求\(1 \le i,j \le n\)的\(gcd(i,j) = 1\)的个数+2(对于0的特判) 正解应该是欧拉函数或者高逼格的莫比乌斯反演 但数据实在太水直接打表算了 /*H E A ...
- POJ 1654 Area(水题)
题目链接 卡了一下精度和内存. #include <cstdio> #include <cstring> #include <string> #include &l ...
随机推荐
- junit单元测试+junit与Spring结合
配置:右键要加入单元测试的工程,选择properties,然后选择java build path,选择add library,选择junit即可. 编写:右键要测试的class,new一个junit ...
- 【bzoj1013】球形空间产生器
高斯消元…… 看完线代那一节之后感觉真的是……naive! 线代大法好. #include<bits/stdc++.h> using namespace std; ; int n; ][] ...
- js判断对象为空
http://www.jb51.net/article/42713.htm var isEmptyValue = function(value) { var type; if(value == nul ...
- iptables内网地外网之间访问
环境:一台带外网和内网的机器,另一台只有内网,默认不能上网.两台机器都是centos系统带外网机器的外网ip为 123.221.20.11, 内网网关ip为 192.168.15.100内网机器的内网 ...
- WN7下安装office2013编辑文档反应这么慢?
把office在高级选项里面“禁用硬件加速”给打勾就OK了. [office 2013密钥] 9MBNG-4VQ2Q-WQ2VF-X9MV2-MPXKV F2V7V-8WN76-77BPV-MKY36 ...
- JVM的分代思想
Java虚拟机根据对象存活的周期不同,把堆内存划分为几块,一般分为新生代.老年代和永久代(对HotSpot虚拟机而言),这就是JVM的内存分代策略. 永久代是HotSpot虚拟机特有的概念,它采用永久 ...
- Git命令使用指南
继续git相关的东西,网上很多讲解的,但是还是喜欢这个图:(爱屋及乌,当然内容也很好,文章链接:http://me.iblogc.com/2015/01/16/Git命令使用指南/) Git是软件开发 ...
- opencv图像二值化的函数cvThreshold()。 cvAdaptiveThreshol
OpenCV中对图像进行二值化的关键函数——cvThreshold(). 函数功能:采用Canny方法对图像进行边缘检测 函数原型: void cvThreshold( const CvArr* sr ...
- RPD Volume 168 Issue 4 March 2016 评论6
Natural variation of ambient dose rate in the air of Izu-Oshima Island after the Fukushima Daiichi N ...
- Hibernate 配置文件precision与scale
Oracle使用标准.可变长度的内部格式来存储数字.这个内部格式精度可以高达38位. NUMBER数据类型可以有两个限定符,如: column NUMBER ( precision, scale) 表 ...