poj 2509 Peter's smokes】的更多相关文章

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…
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; 直…
题意:彼得有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…
题目大意:Peter有n支烟,每k个剩下的烟头可以卷成一支新烟,问Peter能吸多少跟烟? 简单数学题. #include <cstdio> int main() { #ifdef LOCAL freopen("in", "r", stdin); #endif int n, k; while (scanf("%d%d", &n, &k) != EOF) { int ans = n, butt = n; while (b…
#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…
感谢范意凯.陈申奥.庞可.杭业晟.王飞飏.周俊豪.沈逸轩等同学的收集整理.   题号:1003 Hangover求1/2+1/3+...1/n的和,问需多少项的和能超过给定的值 类似于Zerojudge a625 题号:1004 Financial Management 求12个实数的平均值   题号:1008 Maya Calendar 玛雅历 此题语言可选中文 PS:注意Haab历的日期是从0开始,而Tzolkin历的日期是从1开始   题号:1067 取石子游戏 此题语言为中文 PS:请百…
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 1003 Hangover792.762000 1001 Exponentiation752.486000 1006 Biorhythms705.902000 1005 I Think I Need a Houseboat686.540000 1011 Sticks647.566000 1007…
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1019 Grandpa's Other Estate 1034 Simple Arithmetics 1036 Complete the sequence! 1043 Maya Calendar 1054 Game Prediction 1057 Mileage Bank 1067 Rails 10…
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识:while not eof,分支语句,求余 PS:%表示求余 题号:a004: 文文的求婚 背景知识:while not eof,分支语句,判断闰年 题号:a005: Eva 的回家作業 背景知识:循环,if语句,等比数列,等差数列,输出语句 题号:a006: 一元二次方程式 背景知识:if语句的…