Description

Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor GCD(a, b), for example, Euclid algorithm.

Formally, find the biggest integer d, such that all integers a, a + 1, a + 2, ..., b are divisible by d. To make the problem even more complicated we allow a and b to be up to googol, 10100 — such number do not fit even in 64-bit integer type!

Input

The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 10100).

Output

Output one integer — greatest common divisor of all integers from a to b inclusive.

Examples
input
1 2
output
1
input
61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576
output
61803398874989484820458683436563811772030917980576
求a到b的最大公约数
那么只有1和本身这两种情况..
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
string s1,s2;
cin>>s1>>s2;
if(s1==s2)
{
cout<<s1<<endl;
}
else
{
puts("");
}
return ;
}

Codeforces Round #347 (Div. 2) A的更多相关文章

  1. Codeforces Round #347 (Div. 2) C. International Olympiad 找规律

    题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...

  2. Codeforces Round #347 (Div. 2) B. Rebus

    题目链接: http://codeforces.com/contest/664/problem/B 题意: 给你一个等式,把等式左边的问号用1到n(n为等式右边的数)的数填好,使得等式成立 题解: 贪 ...

  3. Codeforces Round #347 (Div.2)_B. Rebus

    题目链接:http://codeforces.com/contest/664/problem/B B. Rebus time limit per test 1 second memory limit ...

  4. Codeforces Round #347 (Div.2)_A. Complicated GCD

    题目链接:http://codeforces.com/contest/664/problem/A A. Complicated GCD time limit per test 1 second mem ...

  5. Codeforces Round #347 (Div. 2) (练习)

    A: 题意:找到[a, b]的最大公约数: 思路:相同时为本身,不同时为1. 套路:碰到水题别想太多: 猜想:两个相邻数,必有一奇一偶,如果偶数有因子3或者其他,奇数可不可能有相同的呢? 枚举一些数后 ...

  6. Codeforces Round #347 (Div. 2)

    unrating的一场CF A - Complicated GCD #include <bits/stdc++.h> const int N = 1e5 + 5; char a[105], ...

  7. codeforces Round #347 (Div. 2) C - International Olympiad

    思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. 前端JS面试题

    题目如下: function Foo() { getName = function () { alert (1); }; return this; } Foo.getName = function ( ...

  2. day36-hibernate检索和优化

    连接查询是多表查询.

  3. css知多少(1)——我来问你来答(转)

    css知多少(1)——我来问你来答   1. 引言 各位前端或者伪前端(比如作者本人)的同志们,css对你们来说不是很陌生.比如我,在几年之前上大学的时候,给外面做网站就用css,而且必须用css.这 ...

  4. opencv 基本数据结构

    转自:http://www.cnblogs.com/guoqiaojin/p/3176692.html opencv 基本数据结构   DataType : 将C++数据类型转换为对应的opencv数 ...

  5. Java-马士兵设计模式学习笔记-工厂模式-单例及多例

    一.单例的作用是用于控制类的生成方式,而不让外部类任意new对象 1.Car.java import java.util.ArrayList; import java.util.List; publi ...

  6. ZROI2018普转提day7t2

    传送门 分析 首先我们不难想到我们一定可以将每一个点分开算,然后看这个点被几个矩形包含 于是对于位置为$(i,j)$的点它被包含的次数为$i * (n-i+1) * j * (m-j+1)$ 这个式子 ...

  7. 精美3D中国象棋

    本人2013年的巅峰之作,现在已经完全免费放送.象棋界面的史诗革命.当前下载版本仅支持Windows 平台. 操作: 方向键的 上,下,左,右 控制棋盘翻转.Home 键回到初始状态,End按键回到平 ...

  8. 数据结构_sfdg(小F打怪)

    问题描述 小 F 很爱打怪, 今天因为系统 bug, 他提前得知了 n 只怪的出现顺序以及击倒每只怪得到的成就值 ai. 设第一只怪出现的时间为第 1 秒,这个游戏每过 1 秒钟出现一只新怪且没被击倒 ...

  9. spring第二篇

    上次写到spring是什么,说了很多的废话,那么从现在起 来看看spring如何使用  写几个例子 1 如何使用 spring 1.1导包 在导入四个包的基础上再导入日志包总共六个包 如下图 1.2 ...

  10. 防恶意解析,禁止用IP访问网站的Apache设置 修改 httpd.conf 实现

    一般来说,网站可以用域名和IP来访问.你的网站可以通过IP直接访问,本来这没什么问题,但是会有些隐患: 由于搜索引擎也会收录你的IP地址的页面,所以同一个页面搜索引擎会重复收录,造成页面的权重不如单个 ...