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 |
我给大家解释一下maoqi同学的程序思想(^_^)如果已知(n1,m1),(n2,m2)为方程t*n^2+1=m^2的两个整数解。(t为大于0的整数) 那么 满足这样的(n,m)也是方程的解: n1*m2(+或-)n2*m1,m=m1*m2(+或-)t*n1*n2 这个是我的程序: 只适合t=8的情况 #include<stdio.h> #include<math.h> int main() { int i; long long res[11]; res[1]=6;res[2]=35; for(i=3;i<=10;i++) res[i]=(res[i-1]*res[i-1]-1)/res[i-2]; for(i=1;i<=10;i++) printf("%10ld%10ld\n",(long)res[i],(long)(sqrt(8*res[i]*res[i]+1)-1)/2); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator