各位大神快来帮帮我!不会啊!在线等 !

#include <iostream>
using namespace std;
int main(){
    int base,above,total;
    cin>>base>>above>>total;
    int t=0;
    if(base/3<above){
        t=(total/base)*3;
        t+=(total%base)/above;
    }else if(base/3>above){
        t+=3;
        total-=base;
        t+=total/above;
    }
    cout<<t<<endl;
}
2 个赞
#include <bits/stdc++.h>
using namespace std;
int base, above, total, minute;
double value1, value2;
int main()
{

    cin >> base >> above >> total;
    if (total < base)
    {
        cout << 0;
    }
    else
    {
        value1 = 1.0 * base / 3;
        value2 = 1.0 * above;
        if (value1 < value2)
        {
            while (total > 0)
            {
                total -= base;
                minute += 3;
            }
            if (total < 0)
            {
                total += base;
                minute -= 3;
            }
            while (total > 0)
            {
                total -= above;
                minute++;
            }
            if (total < 0)
            {
                total += above;
                minute--;
            }
        }
        else
        {
            total -= base;
            minute += 3;
            while (total > 0)
            {
                total -= above;
                minute++;
            }
            if (total < 0)
            {
                total += above;
                minute--;
            }
        }
        cout << minute;
    }
    return 0;
}

2 个赞

重新写了个,看下行不行

2 个赞

两个都对

2 个赞

感谢大神,我完成任务了

2 个赞