Describe
You bought a box of n apples, unfortunately, when you bought it, you got into a bug in the box. Insects can eat an apple every x hours, assuming that the worm does not eat another one before eating an apple, how many complete apples do you have after y hours?
Enter only one line, including N,x and y (all integers). Output output is only one line, the remaining number of apples sample input
10 4 9
Sample output
7
Note: It is required to complete the number of apples.
Idea: This problem is really simple, not much to say, understand test instructions self-can solve! The code is as follows
#include <stdio.h>#include<math.h>//Math operator Header fileintMain () {intN,x,y; scanf ("%d%d%d",&n,&x,&y); N=n-(int) Ceil (y*1.0/x);// roundingif(n>=0) printf ("%d\n", N); Elseprintf"0\n"); return 0;}
Introduction to openjudge-Computing (A)-Apples and Worms