Codeforces Round #347 (Div. 2) A
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!
The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 10100).
Output one integer — greatest common divisor of all integers from a to b inclusive.
- 1 2
- 1
- 61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576
- 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的更多相关文章
- Codeforces Round #347 (Div. 2) C. International Olympiad 找规律
题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...
- Codeforces Round #347 (Div. 2) B. Rebus
题目链接: http://codeforces.com/contest/664/problem/B 题意: 给你一个等式,把等式左边的问号用1到n(n为等式右边的数)的数填好,使得等式成立 题解: 贪 ...
- Codeforces Round #347 (Div.2)_B. Rebus
题目链接:http://codeforces.com/contest/664/problem/B B. Rebus time limit per test 1 second memory limit ...
- 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 ...
- Codeforces Round #347 (Div. 2) (练习)
A: 题意:找到[a, b]的最大公约数: 思路:相同时为本身,不同时为1. 套路:碰到水题别想太多: 猜想:两个相邻数,必有一奇一偶,如果偶数有因子3或者其他,奇数可不可能有相同的呢? 枚举一些数后 ...
- Codeforces Round #347 (Div. 2)
unrating的一场CF A - Complicated GCD #include <bits/stdc++.h> const int N = 1e5 + 5; char a[105], ...
- codeforces Round #347 (Div. 2) C - International Olympiad
思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> ...
- 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 ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
随机推荐
- struts2学习笔记(3)struts.xml的一些常用设置
在开发中通常需要用到多个配置文件,可以通过在web.xml中添加以下代码: <include file="login.xml"></include> 将sr ...
- js利用数组实现队列与堆栈效果
之前在写Android的时候,会用到很多的队列与堆栈方式,其实js利用数组可以简单的实现类似的效果. 队列实现 var queue = new Array(); // unshift() 方法可向数组 ...
- PTA 估值一亿的AI核心代码
题面 比赛时被模拟题打自闭了,本来以为是个比较麻烦的模拟,实际上只要会C++的regex不到40行就能把这个题过掉了(orz smz) regex是用来处理正则表达式,里面有个函数regex_repl ...
- SQL查询语句 [1]
一.使用字符串作为条件查询 在 Home/controller/UserController.class.php 下插入 <?php namespace Home\Controller; use ...
- var_dump — 打印变量的相关信息
<?php $a = array( 1 , 2 , array( "a" , "b" , "c" )); var_dump ( $a ...
- Linux如何修改网络环境参数
如下设置: 检验是否可以连通,就使用ping命令ping 网关开始的时候总是现实unreachable 设置IP:sudo ifconfig eth0 133.133.133.190 netmask ...
- Entity Framework Tutorial Basics(2):What is Entity Framework?
What is Entity Framework? Writing and managing ADO.Net code for data access is a tedious and monoton ...
- 解决SQL Server [Suspect]
昨天因断电,数据库 "DatabaseName" 被标记为 [Suspect],被质疑了? Search 后,以下方案最终解决了问题. USE [master] GO ALTER ...
- ROS nodelet 理解记录
发现网上许多的例子都是基于官网的例子,还需要做进一步的说明. 1. NODELET_DEBUG 是无法打印的信息的,需要使用NODELET_INFO NODELET_DEBUG("Addin ...
- TestNG入门
在Eclipse中安装TestNG 打开Eclipse Help ->Install New Software , 然后Add "http://beust.com/ecli ...