【Codeforces 664A】 Complicated GCD

【题目链接】

          点击打开链接

【算法】

          gcd(a,a+1) = 1

          所以当a = b时,答案为a,否则为1

【代码】

          

#include<bits/stdc++.h>
using namespace std;

string a,b;

int main() {
        
        cin >> a >> b;
        if (a == b) cout<< a << endl;
        else cout<< 1 << endl;
        
        return 0;
    
}

 

posted @ 2018-03-11 19:24  evenbao  阅读(156)  评论(0编辑  收藏  举报