回复 10楼 rjsp
真的不可以啊,我变成长整形也不可以,应该怎么做啊?不过我挺佩服楼主写代码很厉害,我也尝试了用自己的办法写这题,(还没写完),版主大大可以花时间回答怎么解决吗?
把学习时间浪费在混坛上是傻瓜行为,更何况自己的水平连一两都没到。
#include <iostream> using namespace std; unsigned hcf( unsigned a, unsigned b ) // std::gcd { while( b!=0 ) { unsigned t = a; a = b; b = t%b; } return a; } unsigned long long lcd( unsigned a, unsigned b ) // std::lcm { return a/hcf(a,b)*1ull*b; } int main( void ) { unsigned fib[36] = { 0, 1 }; for( size_t i=2; i!=36; ++i ) fib[i] = fib[i-2] + fib[i-1]; for( unsigned x,y; cin>>x>>y; ) { unsigned long long r = lcd( fib[x], fib[y] ); cout << r << '\n'; } }