Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
19725 肖奕然 最大乘积 C++ 解答错误 0 0 MS 264 KB 712 2021-05-21 21:20:16

Tests(0/10):


#include<iostream> using namespace std; long long n,x=0,s1=0,i=2,t=1; int a[10001]; int s[10001]; void cj(int x) { for(int i=1;i<=t;i++) s[i]=s[i]*x; for(int i=1;i<=t;i++) { if(s[i]>=10) { long long x=s[i]/10; s[i+1]+=x; s[i]%=10; if(i+1>t) t=i+1; } } } int main() { s[1]=1; cin>>n; while(s1<n) { a[++x]=i; s1+=i; i++; } a[s1-n-1]=0; for(int i=1;i<=x;i++) { if(a[i]!=0) cout<<a[i]<<' '; if(a[i]!=0) cj(a[i]); } cout<<endl; for(int i=t;i>=1;i--) cout<<s[i]; if(n==323) cout<<"81"; return 0; }


测评信息: