神奇的问题,求助谷民!!
查看原帖
神奇的问题,求助谷民!!
994690
封禁用户楼主2024/8/20 21:37
#include <iostream>
#include <cstring>
using namespace std;

int a[100005], cnt = 0;

void s(int n)
{
	memset(a, sizeof(a), 0);
	cnt = 0;
	for (int i = 1; i * i <= n; i++)
	{
		if (n % i == 0) a[++cnt] = i;
	}
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
    	int n, d, e;
    	bool isP = false;
	    cin >> n >> d >> e;
	    s(n);
	    if (cnt == 1)
	    {
	    	cout << "NO" << endl;
	    	continue;
		}
	    for (int i = 1; i <= cnt; i++)
	    {
	    	if ((a[i]-1) * (n/a[i]-1) + 1 == d * e)
	    	{
	    		cout << a[i] << ' ' << n/a[i] << endl;
	    		isP = true;
			}
		}
		if (!isP) cout << "NO" << endl;
	}
}

这个代码预期是能拿分的,样例也过得去。

可我为什么过不了??我输入大样例 2 的时候,复制粘贴却是这些玩意:

不是这样例不是这吗??

10
24568598 2 12274271
627334722 46 13636459
1498221 26 57041
568827088 89 6391288
632103400 4 158012927
256963728 1 256931611
384696951 93 4136098
1072093 17 62939
831052664 1 830997667
241254720 8 30152063

它为什么会神奇的粘连在一起而没有换行??求助!!

2024/8/20 21:37
加载中...