洛谷-P5709 【深基2.習6】Apples Prologue


洛谷-P5709 【深基2.習6】Apples Prologue

原題鏈接:https://www.luogu.com.cn/problem/P5709


題目描述

八尾勇喜歡吃蘋果。她現在有 \(m(m\le 100)\) 個蘋果,吃完一個蘋果需要花費 \(t(0 \le t \le100)\) 分鍾,吃完一個后立刻開始吃下一個。現在時間過去了 \(s(s\le 10000)\) 分鍾,請問她還有幾個完整的蘋果?

輸入格式

輸入三個非負整數表示 m 、t 和 s。

輸出格式

輸出一個整數表示答案。

如果你出現了 RE,不如檢查一下被零除?

輸入輸出樣例

輸入 #1

50 10 200

輸出 #1

30

C++代碼

#include <iostream>
#include <cmath>
using namespace std;
#define max(x,y) ((x)>(y)?(x):(y))

int main() {
    int m,t,s,ans;
    cin>>m>>t>>s;
    if(t==0)
        cout<<0<<endl;
    else {
        ans=max(m-ceil(s*1.0/t),0);
        cout<<ans<<endl;
    }
    return 0;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM