华华对月月的忠诚

华华对月月的忠诚

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

相关推荐

06-08 22:25
门头沟学院 Java
从零开始的转码生活:这hr不会打开手机不分青红皂白给所有人群发这句话,过一会再给所有人再发一遍,这肯定会有重复的,不管,再过一会再发一遍
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
06-24 14:18
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务