WOJ1035-BG
来源:互联网 发布:阿里云邮客户端 编辑:程序博客网 时间:2024/04/27 13:58
Magicpig and Acm like to compete with each other recently, and the loser has to "BG" the winner, that means, if Magicpig wins, Acm will treat him to a meal. But Acm is so powerful that Magicpig has to "BG" him almost every time. Everybody is very interested in this. So more and more ACMers are attracted to participate in this game.
One day, Peipei said: "It is unfair that one person should 'BG' all the others. I suggest that 50% of the participants should pay the bill. That means, if there are n participants, then Ceil(n/2) person should 'BG' the other n-Ceil(n/2) person." This is a good idea! So all of us agree to do so. This is the story of "BG".
Now you task is: given a number n -- the total number of participants, you have to calculate how many people should pay the bill.
输入格式
The input consists of one or more lines.
Each line contains a positive integer n (2 <= n <= 100).
A line which contains a single 0 will end the input, and should not be processed.
输出格式
A positive integer on each line denoting the required answer.
样例输入
2510130
样例输出
1357
问一个数除2向上取整是多少,可以用ceil,有个简单的方法就是把n加1直接除2
#include<stdio.h>#include<math.h>int main() {int n;while(1) {scanf("%d",&n);if(n==0)break;printf("%d\n",(int)ceil(((double)n)/2.0));}return 0;}
- WOJ1035-BG
- bg
- littleken bg
- vfcbgcf bg
- 毕业bg
- bg命令
- linux bg job fg
- Linux中的bg/fg
- hdu 1881 毕业bg
- bg:后台运行命令
- hdu 1881 毕业bg
- 题目1030:毕业bg
- CDOJ 1528 BG
- fg、bg、jobs、&
- linux fg bg命令
- OJ_1030 毕业bg
- linux kill bg jobs
- HDU 1881 毕业bg
- 彻底弄懂css中字体单位px和em,rem的区别
- UVA
- qt sql多重条件查询简便方法
- ubuntu卸载opencv
- 海思hisi 编译QT源码
- WOJ1035-BG
- 读论文《Auto-Encoding Variational Bayes》
- Comparator-compare
- ios常见错误——thread 1 breakpoint 1.1
- Centos6.5下docker 环境搭建.docx
- UcosII 共享资源的锁机制的处理
- Python 使用folium绘制leaflet地图
- 20160804 冯天鹤笔记
- 20160805冯天鹤笔记