AtCoder Beginner Contest 082 A - Round Up the Mean
2024-10-13 15:28:46
题目链接:https://abc082.contest.atcoder.jp/tasks/abc082_a
Time limit : 2sec / Memory limit : 256MB
Score : 100 points
Problem Statement
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.
Constraints
- a and b are integers.
- 1≤a,b≤100
Input
Input is given from Standard Input in the following format:
a b
Output
Print x rounded up to the nearest integer.
Sample Input 1
Copy
1 3
Sample Output 1
Copy
2
The average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.
Sample Input 2
Copy
7 4
Sample Output 2
Copy
6
The average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.
Sample Input 3
Copy
5 5
Sample Output 3
Copy
5
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b){
if((a+b)%==) cout<<(a+b)/<<endl;
else{
int c=(a+b)/;
if(a+b-*c<=) cout<<c+<<endl;
else cout<<c<<endl;
}
}
return ;
}
最新文章
- 常用Jquery插件整理
- ArrayList转成HashMap再转成LinkedHashMap 自己的解决方案
- 嵌入式linux驱动开发之给linux系统添加温度传感器模块
- json格式转换成Map的应用
- (转)Eclipse “cannot be resolved to a type” error
- js设置与获取Cookie
- VS2015创建的C++程序在Debug模式下不能调试
- jmeter、java自动化学习地址
- 使用Travis CI自动部署Hexo博客
- 山西某公司NetApp存储不小心删除文件数据恢复成功案例
- Business Intelligence Tools We Recommend 1/4 – Metabase
- Debian系统 + XFCE桌面初识,基础环境搭建
- java引用类型简述
- best performance / best appearance
- 3-51单片机ESP8266学习-AT指令(学会刷固件)
- 清除数据库表、外键、存储过程SQL
- linux中合并多个文件内容到一个文件的例子
- 微信小程序如何获取屏幕宽度
- js-jquery-SweetAlert【二】配置方法
- linux 下vim文件乱码 cat文件正常处理方法