solution.cpp 471 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N = 1000;
    int ans;
    int minn = 9999999;
    int sum = 0; //试剂盒的数量
    for (int k = 1; k <= 1000; k++)
    {
        if (N % k == 0)
        {
            sum = N / k + 10 * k;
        }
        else
        {
            sum = N / k + 10 * k + 1;
        }
        if (sum < minn)
        {
            minn = sum;
            ans = k;
        }
    }
    cout << ans;
    return 0;
}