当前位置:网站首页>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;
}
边栏推荐
- Zooinspector Download
- Summary of articles in 2020
- How does PostgreSQL decide PG's backup strategy
- Equals() method of object class
- Pyhanlp installation tutorial
- Day 9 (this keyword and experiment)
- 2019 Hangzhou Electric Multi School Game 7 6651 final exam [Law + thinking]
- Decorator of function
- Sword finger offer 50. the first character that appears only once
- Literature reading: gopose 3D human pose estimation using WiFi
猜你喜欢

Look at the interface control devaxpress WinForms - how to customize auxiliary function properties (Part 2)

Unity2d~ game practice of decrypting Zhou mu (completed in three days)

Convolutional neural network CNN
思源笔记 v2.1.2 同步问题

On July 31, 2022, the dama-cdga/cdgp data governance certification class was opened!

Tencent Browser service TBS usage

Rotation matrix derivation process

Analysis and Simulation of strlen function

Talk about your transformation test development process

【JVM学习04】JMM内存模型
随机推荐
Sword finger offer 50. the first character that appears only once
文献阅读:GoPose 3D Human Pose Estimation Using WiFi
Tupu software digital twin civil aviation flight networking, building a new business form of smart Civil Aviation
The ark compiler is coming. What about APK reinforcement
【JVM学习03】类加载与字节码技术
How to select the shelling tool?
Leetcode402 remove K digits
Pay close attention! List of the latest agenda of 2022 open atom open source Summit
[in depth study of 4g/5g/6g topic -39]: urllc-10 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -3- how to distinguish urllc services? Detailed expl
Jedi survive and eat chicken F12 screenshot save path reference
01 | opening words: teach you to build a blog website hand in hand
Know typescript
Unity code imports packages through package manager
MySQL8.0学习记录19 - 页区段与表空间
Basic idea of regularization
On July 31, 2022, the dama-cdga/cdgp data governance certification class was opened!
Unity框架之ConfigManager【Json配置文件读写】
mysql排序.按字段值排序
Arrays
原反补及大小端