J.Little Sub and Apples

Description

Little Sub loves eating apples and he has n apples initially.
In the following t days, Little Sub will eat k apples each day. If the number of apple is less than k, he will eat all apples instead.
Please calculate the number of apples after t days.

Input

In the fisrt line, it contains three integer n, k, t(0 ≤ n, k, t ≤ 2^31 − 1).

Output

Output the answer in one line.

Author
CHEN, Jingbang

题解:水题,max(0,n-t*k)输出即可.
#include <iostream>
//#include <algorithm>
typedef long long ll;
using namespace std;

int main()
{
    ll n,k,t;
    cin>>n>>k>>t;
    cout<<max(ll(0),n-k*t)<<endl;
    //cout << "Hello world!" << endl;
    return 0;
}
posted @ 2019-03-18 00:51  _yjun  阅读(273)  评论(0编辑  收藏  举报