poj 2509 简单模拟(烟屁换烟)
来源:互联网 发布:水泵选型软件 编辑:程序博客网 时间:2024/06/14 20:45
题意:Peter一开始有n颗烟,已知每抽完m颗可以再得到一颗烟,问他最多能抽多少颗烟。
思路:每轮对于所有烟屁,先换最多的烟抽完,得到新的烟屁数量。
#include <stdio.h>#include <string.h>long long n,m;int main(){ while(scanf("%lld %lld",&n,&m)!=EOF) { long long res = n; while(n/m){ res += n/m; n = n/m+n%m; } printf("%lld\n",res); } return 0;}
0 0
- poj 2509 简单模拟(烟屁换烟)
- poj 1281 MANAGER(简单模拟题)
- POJ 1132 Border(边界) 简单模拟
- poj 2190 简单模拟(ISBN)
- POJ 2000 Gold Coins(简单模拟)
- POJ 1028 Web Navigation(简单模拟)
- POJ 1250 Tanning Salon(简单模拟)
- POJ 3414 Pots(简单模拟+dfs)
- POJ 2897 Dramatic Multiplications(简单模拟)
- POJ 2632 Crashing Robots(简单模拟)
- POJ 2105 IP Address(简单模拟)
- POJ 3087 (简单map + 模拟)
- POJ 1028(简单的模拟浏览器)
- POJ 2453 简单模拟
- POJ 2833 简单模拟
- poj 1573 简单模拟
- POJ 1013 (简单模拟)
- POJ 2996 简单模拟
- 机器学习
- Andriod:开发环境部署,第一个Andriod程序
- 欢迎使用CSDN-markdown编辑器
- assert函数
- hdu 1698
- poj 2509 简单模拟(烟屁换烟)
- 启动 Eclipse 弹 Failed to load the JNI shared library jvm.dll
- 玩转大数据系列之Apache Pig如何与Apache Solr集成(二)
- Java接口与抽象类研究
- treap启发式合并(BZOJ2809)||splay||左偏树
- c与c++中struct区别
- 1. jdbc一般事务步骤
- class demo
- 2015-03-03-Numpy(2)