Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
晕死!就是不过#include<iostream> using namespace std; int n[1000]; int factor(int na) { int num=0; for(int i=1;i<na+1;i++) if(na%i==0) n[num++]=i; return num; } int main() { int i,m,ans1,ans2,ans3,min; __int64 cmp; cin>>m; min=INT_MAX; int num=factor(m); for(i=0;i<num;i++) for(int j=0;j<num;j++) for(int k=0;k<num;k++) { cmp=(__int64)n[i]*(__int64)n[j]*(__int64)n[k]; if( cmp<INT_MAX && cmp>=m && ( n[i]*n[j] + n[i]*n[k] + n[j]*n[k] )<min ) ans1=n[i],ans2=n[j],ans3=n[k],min=(n[i]*n[j]+n[i]*n[k]+n[j]*n[k]); } cout<<ans1<<' '<<ans2<<' '<<ans3<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator