CODEUP爬坑记

版权声明:置顶文章如需转载请联系作者 https://blog.csdn.net/Bonstoppo/article/details/82153497

先刷着。不做评价。

codeup作为辅助刷题的工具,只是刷手感,不作为专门学习。

1818:最大公约数

#include<iostream>
using namespace std;

int gcd(int a, int b) {
	if(b == 0) return a;
	return gcd(b , a % b);
}
int main() {
	int a , b;
	while(scanf("%d%d" , &a , &b) == 2) {
		int c = gcd(a , b);
		printf("%d\n" , c);
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Bonstoppo/article/details/82153497