Codeforces 898 A. Rounding
1 second
256 megabytes
standard input
standard output
Vasya has a non-negative integer n. He wants to round it to nearest integer, which ends up with 0. If n already ends up with 0, Vasya considers it already rounded.
For example, if n = 4722 answer is 4720. If n = 5 Vasya can round it to 0 or to 10. Both ways are correct.
For given n find out to which integer will Vasya round it.
The first line contains single integer n (0 ≤ n ≤ 109) — number that Vasya has.
Print result of rounding n. Pay attention that in some cases answer isn't unique. In that case print any correct answer.
5
0
113
110
1000000000
1000000000
5432359
5432360
In the first example n = 5. Nearest integers, that ends up with zero are 0 and 10. Any of these answers is correct, so you can print 0 or 10.
代码:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll n;
while(~scanf("%lld",&n)){
ll temp=n%;
if(temp>)n=n-temp+;
else n=n-temp;
printf("%lld\n",n);
}
return ;
Codeforces 898 A. Rounding的更多相关文章
- CodeForces 779B Weird Rounding
简单题. 删去结尾的不是$0$的数字,保证结尾连续的$k$个都是$0$,如果不能做到,就保留一个$0$. #include<map> #include<set> #includ ...
- Codeforces 898 C.Phone Numbers-STL(map+set+vector)
C. Phone Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces 898 B.Proper Nutrition
B. Proper Nutrition time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces 898 B(拓展欧几里得)
Proper Nutrition 题意:有n元钱,有2种单价不同的商品,是否存在一种购买方式使得钱恰好花光,如果有输入任意一种方式,如果没有输出“NO” 题解:可以使用拓展欧几里得快速求解. #inc ...
- Codeforces 898 贪心关闭最少闹钟 优先队列最少操作构造N/2squares 讨论情况哈希数字串分割a+b=c
A /* Huyyt */ #include <bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a)) #define mkp(a,b) ...
- Codeforces #402
目录 Codeforces #402 Codeforces #402 Codeforces 779A Pupils Redistribution 链接:http://codeforces.com/co ...
- CF&&CC百套计划3 Codeforces Round #204 (Div. 1) A. Jeff and Rounding
http://codeforces.com/problemset/problem/351/A 题意: 2*n个数,选n个数上取整,n个数下取整 最小化 abs(取整之后数的和-原来数的和) 先使所有的 ...
- Codeforces Round #204 (Div. 2)->C. Jeff and Rounding
C. Jeff and Rounding time limit per test 1 second memory limit per test 256 megabytes input standard ...
- CodeForces 352C. Jeff and Rounding(贪心)
C. Jeff and Rounding time limit per test: 1 second memory limit per test: 256 megabytes input: stan ...
随机推荐
- pyautogui 模块学习
在日常实施中,我们用控件对大部分的网页和客户端都能进行拾取操作.但是仍有一小部分的应用无法进行操作.这里我常用到 pyautogui 这个模块.下面做个分享. Python 的 pyautogui 模 ...
- datagrid的增加功能的实现
一.增加 1.行编辑状态所需的条件 (1)在columns中添加editor,注意type的设置 (2)调用beginEdit方法,开启行编辑 添加到第一行: 添加到最后一行: (2)如果有一行开启了 ...
- Vs2012 打开项目 自动关闭 并停止工作 解决方法
来源:http://q.cnblogs.com/q/52530/ http://www.microsoft.com/zh-cn/download/details.aspx?id=36020 下载并安装 ...
- Python框架之Django学习笔记(一)
Django历史: Django 是从真实世界的应用中成长起来的,它是由 堪萨斯(Kansas)州 Lawrence 城中的一个 网络开发小组编写的. 它诞生于 2003 年秋天,那时 Lawrenc ...
- phpMyAdmin 4.7.x CSRF
phpMyAdmin 4.7.x CSRF 场景:管理员登陆phpmyadmin之后,我试验了一下,发现只要是登陆session没有失效应该是都可以的, 利用,phpmyadmin可以通过get方式操 ...
- 【转】超简单利用UGUI制作圆形小地图
http://sanwen.net/a/ithhtbo.html 由于UI都是Achor自己用PS做的,比较粗糙,大家见谅,不过丝毫不影响功能的实现,下面我们看看今天的笔记: 首先我们看看需要哪些组件 ...
- ruby linux连接windows执行dos命令
在整个开发流程中,gitlab-runner-ci是搭建在linux下.web自动化是在windows下面进行的. 如果ci构建完版本.部署完后,需要触发启动自动化执行. 那么我们需要在部署完后在li ...
- The following signatures couldn't be verified because the public key is not available 解决方法
今天试图把 deepin 的软件源加到我到 Ubuntu 16.04 中去. 在 deepin wiki 上看到一个教程. 在 /etc/apt/sources.list 中加上 deepin 的软件 ...
- set和dict
dict属于mapping类型 from collections.abc import Mapping,MutableMapping from collections.abc import __all ...
- T-SQL获取同类型数据不足补全的方法
业务规则:如果有本地区的招聘会,显示本地区,如果没有本地区的招聘会,显示最近一场. 一条SQL搞定: [userId],[meetsName],[provinceId], [province],[ci ...