최대공약수

BiBi·2021년 1월 19일
0

코딩테스트연습

목록 보기
42/66
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <cmath>
using namespace std;

long long gcd(long long a, long long b) {
	long long tmp;
	while (b != 0) {
		tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}


int main() {
	//freopen("input.txt", "rt", stdin);
	long long a, b;
	cin >> a >> b;
	long long c = gcd(a, b);
	for (int i = 0; i < c; i++) {
		cout << '1';
	}


	return 0;
}
profile
Server Network Engineer

0개의 댓글