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;
}
原文地址:https://www.cnblogs.com/-yjun/p/10549912.html