cigarettes 向右看齐 2022-06-02 09:17 141阅读 0赞 ## cigarettes ## 时间限制: 3000 ms | 内存限制: 65535 KB 难度: 2 **描述** Tom has many cigarettes. We hypothesized that he has n cigarettes and smokes them one by one keeping all the butts. Out of k > 1 butts he can roll a new cigarette. Now,do you know how many cigarettes can Tom has? 输入 First input is a single line,it's n and stands for there are n testdata.then there are n lines ,each line contains two integer numbers giving the values of n and k. 输出 For each line of input, output one integer number on a separate line giving the maximum number of cigarettes that Peter can have. 样例输入 3 4 3 10 3 100 5 样例输出 5 14 124 来源 [\[rooot\]原创][rooot] 上传者 [rooot][rooot 1] 该题的翻译很社会![偷笑][titter.gif],还是不要看为好,自己参悟,此题与喝啤酒拿酒盖换酒类似链接[点击打开链接][Link 1] #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> using namespace std; int main() { int test; scanf("%d",&test); while(test--) { int n,k,i,j,ans; scanf("%d%d",&n,&k); ans=n; while(n>=k) { ans+=n/k; n=n/k+n%k; } printf("%d\n",ans); } return 0; } [rooot]: http://59.69.128.203/JudgeOnline/search_result.php?source=%5Brooot%5D%E5%8E%9F%E5%88%9B [rooot 1]: http://59.69.128.203/JudgeOnline/profile.php?userid=rooot [titter.gif]: http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif [Link 1]: /images/20220602/bbdd8a09eb614d998e304fef7544aee2.png
相关 题目94 cigarettes ![20160729122704140][] 已AC代码: include<cstdio> using namespace std; in 野性酷女/ 2022年09月24日 11:14/ 0 赞/ 70 阅读
相关 NYOJ 94 cigarettes cigarettes 时间限制: 3000 ms | 内存限制: 65535 KB 难度: 2 描述 Tom has many cigarettes. We hyp 怼烎@/ 2022年08月25日 02:08/ 0 赞/ 54 阅读
相关 南阳题目94-cigarettes cigarettes 时间限制: 3000 ms | 内存限制: 65535 KB 难度: 2 描述 Tom has many cigarettes. We hyp 淡淡的烟草味﹌/ 2022年07月27日 13:56/ 0 赞/ 237 阅读
相关 cigarettes cigarettes 时间限制: 3000 ms | 内存限制: 65535 KB 难度: 2 描述 Tom has many cigarettes. We h 向右看齐/ 2022年06月02日 09:17/ 0 赞/ 142 阅读
还没有评论,来说两句吧...