题目链接:http://codeforces.com/contest/664/problem/A

A. Complicated GCD
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 bare 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

解题报告:

可以看到,两个字符串相同,输出这个字符串,否则输出1;

#include <stdio.h>
#include <iostream>
#include <string>using namespace std;int main()
{string a,b;cin>>a>>b;if(a==b) cout<<a<<endl;else cout<<"1"<<endl;return 0;
}

转载于:https://www.cnblogs.com/TreeDream/p/5405863.html

Codeforces Round #347 (Div.2)_A. Complicated GCD相关推荐

  1. Codeforces Round #736 (Div. 2) D. Integers Have Friends ST表gcd + 尺取

    传送门 文章目录 题意: 思路: 题意: 给你一个序列aaa,求一个最长的子序列[l,r][l,r][l,r]满足aimodm=ai+1modm=...=armodma_i\bmod m=a_{i+1 ...

  2. Codeforces Round #563 (Div. 2)/CF1174

    Codeforces Round #563 (Div. 2)/CF1174 CF1174A Ehab Fails to Be Thanos 其实就是要\(\sum\limits_{i=1}^n a_i ...

  3. Codeforces Round #698 (Div. 2)(A ~ F)6题全,超高质量题解)【每日亿题】2021/2/4

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 [每日亿题]Codeforces Round #698 (Div. 2)(A ~ F)6题全,超 ...

  4. Codeforces Round #694 (Div. 1 + Div2)(A ~ H,8题全,超高质量题解)【每日亿题】2021/2/1、2/2

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 [每日亿题]Codeforces Round #694 (Div. 1 + Div2)(A ~ ...

  5. Codeforces Round #514 (Div. 2)题解

    Codeforces Round #514 (Div. 2)题解 A 喵,直接模拟. B 枚举所有盖章时的,合法的,左上角的位置.能盖的话就盖一下.最后check一下图案是否相等即可 C 一轮一轮的扔 ...

  6. CodeForces 839D - Winter is here | Codeforces Round #428 (Div. 2)

    赛后听 Forever97 讲的思路,强的一匹- - /* CodeForces 839D - Winter is here [ 数论,容斥 ] | Codeforces Round #428 (Di ...

  7. Codeforces Round #250 (Div. 2) A - The Child and Homework

    传送门Codeforces Round #250 (Div. 2) A - The Child and Homework 第一次做完之后交上去,过了例子.顺手就锁定了...然后一个小时之后就被HACK ...

  8. Codeforces Round #675 (Div. 2) F. Boring Queries 区间lcm + 主席树

    传送门 文章目录 题意: 思路: 题意: 给你一个长度为nnn的序列aaa,qqq个询问,每次询问[l,r][l,r][l,r]内的lcmlcmlcm是多少,对1e9+71e9+71e9+7取模. n ...

  9. Codeforces Round #586 (Div. 1 + Div. 2) D. Alex and Julian 数学 + 思维

    传送门 文章目录 题意: 思路: 题意: 给你一个无限个点的坐标轴,一个集合BBB,如果存在∣i−j∣=bk|i-j|=b_k∣i−j∣=bk​的话,那么i,ji,ji,j之间就连边.现在问你至少要从 ...

  10. CodeCraft-21 and Codeforces Round #711 (Div. 2) 题解

    先上链接CodeCraft-21 and Codeforces Round #711 (Div. 2) A: 从n开始往后找,不出几十个 一定能找到的,所以暴力就好了 void sovle(){cin ...

最新文章

  1. springboot集成freemarker 配置application.properties详解
  2. Linux上调整sshd进程的优先级
  3. B. Product(2019ICPC西安邀请赛)(杜教筛)
  4. 【音视频安卓开发 (二)】
  5. 诗与远方:无题(三十二)- 曾经写给妹子的一首诗
  6. qt-sdk-linux,在linux系统上安装qt-sdk步骤.doc
  7. 移动APP开发的五个重要步骤
  8. SourcesTree使用手册3:文件贮藏与删除
  9. OC 自定义 get/set 方法注意点
  10. html ajax请求乱码,关于Ajax请求中传输中文乱码问题的解决方案
  11. 【梦幻童年win7热门主题】
  12. 按键精灵手机助手连接mumu模拟器的方法,适用于任何模拟器连接按键精灵手机助手
  13. oracle sqlldr decode,sqlldr时遇到的一个问题
  14. 饿了么api接口 php,饿了么美团开放平台接入
  15. 基于SSM的概念可视化程序设计学习系统毕业设计源码021009
  16. LOJ 6131 Fiend - 行列式 - 可并堆 - 贪心
  17. 前端可视化技术-笔记
  18. Web3.0 对网络安全世界的影响
  19. win12服务器文件设置只读,高手亲自讲解win10文件夹只读属性改不了的修复办法...
  20. mysql 进入_如何进入MySQL

热门文章

  1. 设计模式学习-每日一记(16.模板方法模式)
  2. 面向Transformer模型的高效预训练方法
  3. 教你如何用机翻软件开拓自己的青青草原
  4. 每日算法系列【LeetCode 122】买卖股票的最佳时机 II
  5. 每日算法系列【LeetCode 312】戳气球
  6. LeetCode—4.滑动窗口
  7. 用Spring Cloud Alibaba开发微服务为什么越来越香?
  8. 3.概率分布函数与概率密度函数
  9. 06向量及其坐标表示、向量的方向角与方向余弦、向量组共线与共面的条件、向量的加法与数乘运算、向量组的线性组合、二维向量的基向量分解、三维向量的基向量分解、用坐标做向量的数乘
  10. Synchronous Bidirectional Inference for Neural Sequence Generation