求调
查看原帖
求调
787888
Channel_Choo楼主2024/11/21 17:24
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
	long long a; 
    long long pot = 0;
    while (cin >> a)
    {
    	if (a == 0)
    	{
    		break;
		}
        pot++;
        long long num = 0, cast[100005];
        for (int i = sqrt(a);i >= 1;i--)
        {
            if (a % i == 0)
            {
                cast[++num] = i + a / i;
            }
        }
        long long maxx = 0x3f3f3f;
        for (int i = 1;i <= num;i++)
        {
        	maxx = min(cast[i], maxx);
		}
		cout << "case " << pot << ": " << maxx << endl;
    }
    return 0;
}

为什么会WA,本蒟蒻很疑惑,明明样例都能过

2024/11/21 17:24
加载中...