D - 小树快长高
Description
小明在植樹節(jié)種了一棵小樹,小明非常關(guān)心小樹,每天都給小樹澆水,盼望著小樹快快長高。他知道小樹現(xiàn)在有?n?cm,每天長高k?cm,他想知道多少天小樹可以長到m?cm。
Input
輸入三個整數(shù)? n, m, k。 ( 0 <= n<= 10000, 0 <= m <= 10000,0 <= k <= 10000)
Output
輸出一個整數(shù),即需要的天數(shù)。
Sample
Input?
100 200 5Output?
20 #include <stdio.h> #include <stdlib.h> int main() {int i, n, m, k, t, count;i = 0;count = 0;scanf("%d %d %d", &n, &m, &k);t = m - n;while(t > 0){t = t - k;count++;}printf("%d\n", count);return 0; }總結(jié)
- 上一篇: 巨控GRM110系列的LORA无线通信模
- 下一篇: 7-224 sdut-C语言实验-排序问