2 solutions

  • 1
    @ 2026-4-25 18:48:56
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b;
    	cin>>a>>b;
    	int cnt=0;
    	for(int i=a;i<=b;i++)
    	{
    		int c=0;
    		for(int j=1;j<=i;j++)
    		{
    			if(i%j==0)
    			{
    				c++;
    			}
    		}
    		if(c==2)
    		{
    			cnt++;
    		}
    	}
    	cout<<cnt;
    	return 0;
    }
    
    
    • -1
      @ 2026-8-21 20:46:05
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int a,b;
      	cin>>a>>b;
      	int d=0;
      	int c=0;
      	for(int i=a;i<=b;i++)
      	{
      		c=0;
      		for(int s=2;s<i;s++)
      		{
      			if(i%s==0)
      			{
      				c++;
      			}
      		}
      		if(c==0)
      		{
      			d++;
      		}
      	}
      	cout<<d;
      	return 0;
      }
      • 1

      Information

      ID
      1163
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      # Submissions
      108
      Accepted
      38
      Uploaded By