华华对月月的忠诚

华华对月月的忠诚

http://www.nowcoder.com/questionTerminal/647d45470c63407db0152d3ebb407fa3

想一下求最大公约数的辗转相除法,如果用在斐波那契数列上,就会得到,直接求前两个数字就行了

# include <cstdio>
# include <cstring>
# include <cctype>
# include <cmath>
# include <cstdlib>
# include <climits>
# include <iostream>
# include <iomanip>
# include <set>
# include <map>
# include <vector>
# include <stack>
# include <queue>
# include <algorithm>
using namespace std;


const int debug = 1;
const int size  = 5000 + 10;
const int INF = INT_MAX>>1;
typedef long long ll;

int main()
{
    // std::ios::sync_with_stdio(false);cin.tie(0);
    ll a, b, n;
    cin >> a >> b >> n;
    cout << __gcd(a, b) << endl;
    return 0;
}
全部评论

相关推荐

头像
11-09 12:17
清华大学 C++
out11Man:小丑罢了,不用理会
点赞 评论 收藏
分享
10-24 13:36
门头沟学院 Java
Zzzzoooo:更新:今天下午有hr联系我去不去客户端,拒了
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务