Untitled

mail@pastecode.io avatar
unknown
c_cpp
19 days ago
1.0 kB
0
Indexable
Never
#include <iostream>
#include <cmath>
#include <string>
using namespace std;


void mas(long long a, long long b)
{
	int best_the_N = 0;

	bool h = false;
	bool h2 = false;

	for (int i = 1; i < a + 1; i++)
	{
		if (float(float(a) / float(i)) - a / i == 0)
		{
			best_the_N++;
		}
	}

	if (best_the_N <= 2)
	{
		h=true;
	}

	if (best_the_N > 2)
	{
		h=false;
	}

	//2

	best_the_N = 0;

	for (int i = 1; i < b + 1; i++)
	{
		if (float(float(b) / float(i)) - b / i == 0)
		{
			best_the_N++;
		}
	}

	if (best_the_N <= 2)
	{
		h2 = true;
	}

	if (best_the_N > 2)
	{
		h2 = false;
	}

	if (h == true and h2 == true)
	{
		cout<< long long(a + b);
	}

	else
	{
		cout<< "ERROR";
	}
}

int main()
{
	long long a = 0;
	long long b = 0;
	cin >> a;
	cin >> b;
	if (a < -2 or b < -2)
	{
		for (int i = 0; i < 1000; i++)
		{
			cout << "NEVER GONNA GIVE U UP; NEVER GONNA LET U DOWN AND SEARCH U";
		}
	}

	else
	{
		mas(a, b);
	}
}
Leave a Comment