https://www.xinyoudui.com/contest?courses=565&books=515&pages=15002&fragments=44924&problemId=1197
1 个赞
#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;
}
1 个赞