超时疑惑
查看原帖
超时疑惑
351116
qy712楼主2025/1/14 15:53
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n;
    double t, max = 0;
    cin >> n;
    int a[3], b[3];
    double cost[3]; 
    for (int i = 1; i < 4; i++)
    {
        cin >> a[i] >> b[i];
        cost[i] = ceil(n * 1.0 / a[i]) * b[i];
    }
    for (int i = 1; i < 4; i++)
    {
        if (cost[i] > max)
        {
            max = cost[i];
        }
    }
    int temp = int(max);
    cout << temp;
}

这代码为什么会超时呢

2025/1/14 15:53
加载中...