当前位置:网站首页>872. Maximum common divisor
872. Maximum common divisor
2022-07-24 19:36:00 【acacac.】
Given n Right integer ai,bi, Please find the greatest common divisor of each logarithm .
Input format
The first line contains integers n.
Next n That's ok , Each line contains an integer pair ai,bi.
Output format
The output, n That's ok , Each line outputs the maximum common divisor of an integer pair .
Data range
1≤n≤105,
1≤ai,bi≤2×109
sample input :
2
3 6
4 6
sample output :
3
2
#include<bits/stdc++.h>
using namespace std;
int n;
int gcd(int a, int b)
{
return b ? gcd(b, a % b) : a;
}
int main()
{
cin >> n;
int a, b;
for(int i=0; i<n; i++) {
cin >> a >> b;
cout << gcd(a ,b) << endl;
}
return 0;
}
边栏推荐
- Database index: index is not a panacea
- Unity code imports packages through package manager
- 【无标题】
- Common methods of string class
- 2019 Hangdian multi school first 6581 vacation [thinking]
- Math
- Arrays
- Nezha monitoring - server status monitoring, SSL certificate change expiration, Ping monitoring and scheduled task reminder
- Pay close attention! List of the latest agenda of 2022 open atom open source Summit
- Description of large and small end mode
猜你喜欢

Techempower web framework performance test 21st round results release --asp Net core continue to move forward

Detailed explanation of ELF format (I)

Use of paging assistant PageHelper

Why are there loopholes in the website to be repaired

day 2

Talk about your transformation test development process
![Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]](/img/77/28e8f826c7ee93fedada405c70b82b.png)
Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]

Timed task framework

拿捏C指针

Analysis of the basic concept of digital warehouse
随机推荐
Sword finger offer 40. minimum number of K
How to select software dongle
Mysql8.0 learning record 19 - Page segments and tablespaces
MySQL8.0学习记录19 - 页区段与表空间
MySQL8.0学习记录20 - Trigger
Ensure the health and safety of front-line construction personnel, and implement wrong time construction at Shenzhen construction site
湖仓一体释放全量数据价值,SequoiaDB v5.2线上发布会重磅来袭
PostgreSQL Elementary / intermediate / advanced certification examination (7.16) passed the candidates' publicity
【JVM学习03】类加载与字节码技术
Decision tree_ ID3_ C4.5_ CART
01 | 开篇词:手把手教你搭建一个博客网站
profile环境切换
How to use the interface control telerik UI for WinForms development step progress bar?
How to convert the world coordinates of unity's camera into view matrix
asp. Net coree file upload and download example
思源笔记 v2.1.2 同步问题
Database index: index is not a panacea
Installation and use of lsky Pro lancong drawing bed: a drawing bed program for online uploading and managing pictures
Interface component devaxpress asp Net v22.1 - new office 365 dark theme
Analysis and Simulation of strlen function