难以理解
查看原帖
难以理解
1017629
ZSB00000楼主2025/1/6 18:46

这一份代码编译失败

#include<bits/stdc++.h>
using namespace std;
long long x[3000001] = {0, 1}, n, p;
int main() {
	ios::sync_with_stdio(false);
	cin >> n >> p;
	cout << 1 << endl;
	for (int c = 2; c <= n; c++) {
		x[c] = (p - (p / c)) * x[p % c] % p;
		cout << x[c] << '\n';
	}
	return 0;
}

错误信息:
Nothingiscompiled:OUTPUTexceeds.Nothing is compiled: OUTPUT exceeds.
记录

这一份是满分代码:

#include<bits/stdc++.h>
using namespace std;
long long x[3000001]={0,1},n,p;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>p;
	cout<<1<<endl;
	for(int c=2;c<=n;c++)
   	{
       	x[c]=p-(p/c)*x[p%c]%p;
		cout<<x[c]<<'\n';
   	}
   return 0;
}

记录

有啥不同???

2025/1/6 18:46
加载中...