Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
19997 季洁 最大乘积 C++ Wrong Answer 20 0 MS 252 KB 340 2021-05-27 21:16:28

Tests(2/10):


#include<bits/stdc++.h> using namespace std; int main(){ int n,i=2,l=0,sum=1,z=0; cin>>n; int a[(int)sqrt(n)+1]; while(1){ if(!(n-i>=0)) break; a[++l]=i; n-=i; i++; } int x=l; while(n){ a[x--]++; n--; } for(int j=1;j<=l;j++){ sum*=a[j]; } while(sum){ z=z+sum%10; sum/=10; } cout<<z; }


Judgement Protocol: