#10 WA!!! Too short on line 1.
查看原帖
#10 WA!!! Too short on line 1.
450893
yangyuanxi44楼主2021/8/3 17:38

#10 WA!!! Too short on line 1.

#include<bits/stdc++.h>
using namespace std;
int a[10000];
int ans[10001];
int t;
void gjc(int x){
	for(int i=1 ; i<=10000 ; i++) ans[i]=ans[i]*x;
	for(int i=1 ; i<=10000 ; i++){
		if(ans[i]>=10){
			long long ad=ans[i]/10;
			ans[i+1]+=ad;
			ans[i]=ans[i]%10;
			if(i+1>t) t=i+1;
		}
	}
}
int main(){
	int n;
	cin>>n;
	int sum=0;
	int cnt=2;
	while(sum<n){
		sum+=cnt;
		cnt++;
	}
	int cz=sum-n;
	int j=2,t=1;
	for(int i=1 ; i<=cnt-2 ; i++){

		if(j!=cz){
			a[t]=j;
			t++;
		} 
		j++;
	}
	for(int i=1 ; i<=j-3 ; i++) cout<<a[i]<<" ";
	cout<<endl;
	ans[1]=1;
	for(int i=1 ; i<=j-3 ; i++) if(a[i]!=0) gjc(a[i]);
	int be=10000;
    while(ans[be]==0) be--;
	for(int i=be ; i>=1 ; i--) cout<<ans[i];
	return 0;
}

谢谢大佬指正

2021/8/3 17:38
加载中...