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 ...
随机推荐
- Oracle 11g 安装环境配置脚本
#!/bin/bash #Test in RHEL 5.5 for 11g c=`cat /etc/shadow | grep oracle | wc -l`if [ $c != 0 ]then w ...
- 使用System.getProperty("line.separator")时没有换行问题解决
项目中要实现替换模版txt文本里面的内容,然后生成新的文档,其中先把模版文本的内容通过创建的 BufferedReader bufReader 使用 readLine() 来一行一行读取,所以在完成替 ...
- UVALive - 5844
题是pdf版 Sample Input23mississippinni55i55ippi2foobar|=o08arSample Output10 /** 题意:给出一个normal串,一个leet串 ...
- hdu 3006(状态压缩)
The Number of set Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- MATLAB作图方法与技巧(一)
下面从折线图.曲面图和图形说明与定制三个方面说明MATLAB作图的一些方法与技巧,注意,文中出现的单引号在MATLAB中实际运行的时候,需要改为MATLAB认可的单引号. 一. 作折线图 1.plot ...
- 【转+整理】jenkins与SonarQube集成
一.SonarQube 我的理解是,SonarQube就是一个对代码进行分析的平台,其功能可以通过插件扩展.支持多种语言,也支持静态代码检查.发现潜在bug等. 以下是参考信息: 维基百科:https ...
- 7/26 CSU-ACM2018暑期训练3-递归&递推-选讲
题目链接 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法. Input 第一行是测试数据的数目t(0 <= ...
- JavaScript代码放在head和body的区别(QRCode生成)
1.在head中时,所代表的functions只加载而不执行,执行是在某一事件触发后才开始. 2.在body中时,直接加载并执行 典型的区别: 如果有不在函数中的执行语句,比如变量初始化,如果在hea ...
- Codeforces #430 Div2 D
#430 Div2 D 题意 给出一些数,每次操作先将所有数异或一个值,再求这些数中没有出现过的最小的非负整数. 分析 对于更新操作,对于 \(x\) 所有为 \(1\) 的位给相应层添加一个标记,当 ...
- NULL always return false
Any comparison with null is false - = and <>, >, <, and so on. You cannot use null in an ...