【1080】余数相同的问题

分析:用循环求出数据,再break即可。

#include<iostream>
//#include<iomanip>
//#include<cmath>
//using std::fixed;
//using std::setprecision;
using std::cin;
using std::cout;


int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	for (int i = 2;; ++i)
	{
		if (a % i == b % i && b % i == c % i)
		{
			cout << i;
			break;
		}
	}
}

猜你喜欢

转载自blog.csdn.net/LWX3289765163/article/details/121214102
今日推荐