1 / 6
Mar 2020

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main ()
{

ll a,b,n;
cin >>a>>b>>n;


ll  d[b-a+1];
ll k=0;
for(ll i=a;i<=b;i++)
{
    ll no=i;
    d[k]=1;
    for(ll j=2;j<=i;j++)
    {
        if(no%j==0)
        {
            while(no%j==0)
            {
                d[k]++;
                no=no/j;
            }
        }
    }
    if(no>2)
    {
        d[k]++;
    }

    k++;
}
ll result=0;

for(ll i=0;i<b-a+1;i++)
{
    if(d[i]==n)
        result++;
}

cout <<result;

return 0;

}

  • created

    Mar '20
  • last reply

    Mar '20
  • 5

    replies

  • 602

    views

  • 3

    users

  • 1

    link

Even I have checked other inputs
But when i submit it it shows wrong answer
Don’t know which of the cases I m missing
Can you look in the code and give some suggestions

Here’s a couple

1 100 3
1 10000 24

Expected answers 4 and 449.

Please show me your “other inputs”.

And check for example something like this:

999990000 1000000000 1   
999990000 1000000000 2
999990000 1000000000 3
999990000 1000000000 4
...
etc

My expection from your program in this cases is only to make any answer in time limit.

Yes of course. My suggestion, rethinking and start coding from beginning.