1 solutions

  • 0
    @ 2025-2-12 12:33:04
    #include <iostream>
    using namespace std;
    int cnt=0;
    int main(){
        int m,t,s;
        cin>>m>>t>>s;
        if(t==0){
            cout<<m;
            return 0;
        }
        for(int i=t;i<=s;i+=t){
            cnt++;
        }
        cout<<(m-cnt);
        return 0;
    }
    

    如果t是0的话,直接输出苹果的个数。

    循环里面,i不再是+1,而是+t,因为t是吃一个苹果的时间,cnt每一轮++。

    最终输出剩下的个数,用m减cnt。

    Information

    ID
    441
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    38
    Accepted
    21
    Uploaded By