杭电OJ2012

#include <iostream>
using namespace std;
int main()
{
	int x, y;
	while (cin >> x >> y)
	{
		if (x == 0 && y == 0)
			break;
		int s,t=0;
		for (int i = x; i <= y; i++)
		{
			s = i*i + i + 41;
			for (int j = 2; j < s; j++)
			{
				if (s%j == 0)
					t++;
			}
		}
			if (t == 0)
				cout << "OK" << endl;
			else
				cout << "Sorry" << endl;
	}
}

猜你喜欢

转载自blog.csdn.net/weixin_42265486/article/details/83615012