UVa 10346 Peter's Smokes

题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1287
规律题,通过计算可知道总烟数n=a1+a1/a2和n=a1+a1/a2-1
#include"stdio.h"
int main()
{
int apple,pea,orange;
while(scanf("%d%d",&apple,&pea)!=EOF)
{
if(apple%(pea-1)==0)
{
orange=apple+apple/pea-1;
}
if(apple%(pea-1)!=0)
{
orange=apple+apple/pea;
}
printf("%d\n",orange);
}
renturn 0;
}

原文地址:https://www.cnblogs.com/miaosu5limi/p/2932476.html