80-3-超时-救救孩子
查看原帖
80-3-超时-救救孩子
922134
jiejielove楼主2023/2/8 15:39
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<string>
using namespace std;


int main()
{
	long n,m;
	cin >> n>>m;
	int count = 0;
	if (n > m)
	{
		swap(n,m);
	}
	for (int i = n; i <= m; i++)
	{
		for (int j = 2; j <i; j++)
		{
			if (i % j == 0)
			{
				break;
			}
			if (j == i - 1)
			{
				count++;
			}
		}	
	}
	cout << count;
	return 0;
}

2023/2/8 15:39
加载中...