华华对月月的忠诚

华华对月月的忠诚

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;
}
全部评论

相关推荐

狠赚笔第一人:学计算机自己不努力怪大环境?我大一就拿到了美团大厂的offer,好好看看自己有没有努力查看图片
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务