1024: Mobile phone time limit: 1 Sec memory limit: MB
Submitted by: 2500 Resolution: 1250
Submitted State [Download (1 RMB)] The topic describes Xiao Ming's mobile phone daily consumption of 1 yuan, each consumption of K yuan can be donated 1 yuan, at the beginning, Xiao Ming has m yuan, how many days can I ask? The input input includes multiple test instances. Each test instance consists of 2 integer m,k (2<=k<=m<=1000). M=0,k=0 represents the end of the input. The output outputs an integer for each test instance that represents the number of days that the M-element can be used. Sample input
2 24 30 0
Sample output
35
1#include <stdio.h>2 intMain ()3 {4 intm,k,d;5 while(SCANF ("%d%d", &m,&k) &&m| |k)6 {7D=0;//Be aware of the initialization location! If you put it in a different global result! 8 while(m--//Money is always reduced before welfare, minus 0 to exit9 {Tend++and//The days passed d+1 One if(d%k==0) Am++and//When it comes time to spend k dollars, that's when you return to m+1. - } -printf"%d\n", d); the } - return 0; -}
"TK" 1024: Mobile phone charges