POJ 2509】的更多相关文章

POJ 2509 Peter的香烟 描述 Peter抽烟.他抽烟一个个地抽着烟头.从 k (k>1) 个烟头中,他可以抽一根新烟.彼得可以抽几支烟? 输入 输入是一系列行.每行包含两个给出n和k值的整数. 输出 对于输入的每一行,在单独的行上输出一个整数,给出Peter可以拥有的最大香烟数量. 样本输入 4 3 10 3 100 5 样本输出 5 14 124 思路 输入n之后,判断n是否大于等于k,如果是,那么: u = n / k; n -= u * k; s += u; n += u; 直…
http://poj.org/problem?id=2509 Peter's smokes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16957   Accepted: 6984 Description Peter has n cigarettes. He smokes them one by one keeping all the butts. Out of k > 1 butts he can roll a ne…
题意:彼得有n支雪茄,每k个烟头可以换一支新雪茄,问彼得最多可以吸多少支雪茄 ? 当时自己做时,错在了直接在while循环开始前,便将雪茄的初始数量给加上了,然而应该是先处理后再加上最终剩余的雪茄数量. #include<stdio.h> int main() { int n,k; while(scanf("%d%d",&n,&k)!=EOF) { ; while(n/k) { res+=k*(n/k); n=n%k+n/k; } res+=n; print…
#include <iostream> #include <stdio.h> using namespace std; int main() { //freopen("acm.acm","r",stdin); int n; int k; int sum; int mod; int tem; while(cin>>n>>k) { sum = ; while(n >= k) { mod = n % k; tem =…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
链接: http://poj.org/problem?id=3259 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/B Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 25079   Accepted: 8946 Description While exploring his many farms, Farmer…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…