14 条题解

  • 1
    @ 2025-12-14 15:24:00
    #include <iostream>
    using namespace std;
    int m,n;
    bool a = true;
    int main()
    {
    	cin >> m >> n;
    	short ans = 0;
    	if (m == 1)
    		m = 2;
    	for (int i = m;i <= n;i++)
    	{
    		for (int j = 2;j < i;j++)
    		{
    			if (i % j == 0)
    				a = false;
    		}
    		if (a == true)
    		{
    			cout << i << ' ';
    			ans++;
    		}
    		a = true;
    	}
    	cout << endl << ans;
    	return 0;
    }

    信息

    ID
    947
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    1282
    已通过
    391
    上传者