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 |
其实说在这里贴源程序作用不大,实验证明In Reply To:到底哪里错了 各位帮忙看一下吧 谢谢 Posted by:00448132 at 2005-04-29 12:31:12 > #include <iostream.h> > #include <math.h> > > int main() > { > long n; > long num1,num2,num3; > long temp,temp1,temp2,temp3; > long a,b,c,e,f,g; > long t=0; > cin>>n; > while(n--){ > long max=0; > cin>>e>>f>>g; > a=e; > b=f; > c=g; > max=a%10; > for(long k=1;k<10;k++){ > if(a==0) break; > temp=a%10; > a=a/10; > if(max<temp) max=temp; > } > for(k=1;k<10;k++){ > if(b==0) break; > temp=b%10; > b=b/10; > if(max<temp) max=temp; > } > for(k=1;k<10;k++){ > if(c==0) break; > temp=c%10; > c=c/10; > if(max<temp) max=temp; > } > > for(long i=max+1;i<=16;i++){ > num1=e; > num2=f; > num3=g; > temp1=0; > temp2=0; > temp3=0; > for(long j=0;j<=10;j++){ > if(num1==0) break; > temp1+=long(pow(i,j))*(num1-num1/10*10); > num1=num1/10; > } > for(j=0;j<=10;j++){ > if(num2==0) break; > temp2+=long(pow(i,j))*(num2-num2/10*10); > num2=num2/10; > } > for(j=0;j<=10;j++){ > if(num3==0) break; > temp3+=long(pow(i,j))*(num3-num3/10*10); > num3=num3/10; > } > if(temp1*temp2==temp3){ > cout<<i<<endl; > t=1; > break; > } > } > if(t==0) cout<<'0'<<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