Submission #2461362


Source Code Expand

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn=100000;
int cnt=0;
int a[100010];
int prime[100010];
void init();
int main()
{
    ios::sync_with_stdio(false);
    int l,r;
    init();
    scanf("%d %d",&l,&r);
        int ans=0;
        for(int i=l;i<=r;i++)
        {
                int sum=0,n=i;
                for(int j=0;prime[j]*prime[j]<=n;j++)
                {
                    while(!(n%prime[j]))
                    {
                        n/=prime[j];
                        sum++;
                    }
                }
                if(n!=1)
                    sum++;
                if(!a[sum])
                    ans++;
        }
        printf("%d\n",ans);
    return 0;
}
void init()
{
    a[1]=1;
    a[0]=1;

    for(ll i=2; i<=100000; i++)
    {
        if(!a[i])
        {
            prime[cnt++]=i;
            for(ll j=i*i; j<=100000; j+=i)
            {
                a[j]=1;
            }
        }
    }
}

Submission Info

Submission Time
Task C - Prime-Factor Prime
User hyacinthus
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1111 Byte
Status AC
Exec Time 1912 ms
Memory 768 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&l,&r);
                         ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 59
Set Name Test Cases
All 00_sample_00, 00_sample_01, 00_sample_02, 00_sample_03, 00_sample_04, 00_sample_05, 10_small_00, 10_small_01, 10_small_02, 10_small_03, 10_small_04, 10_small_05, 10_small_06, 10_small_07, 10_small_08, 10_small_09, 20_medium_00, 20_medium_01, 20_medium_02, 20_medium_03, 20_medium_04, 20_medium_05, 20_medium_06, 20_medium_07, 20_medium_08, 20_medium_09, 30_medium_00, 30_medium_01, 30_medium_02, 30_medium_03, 30_medium_04, 30_medium_05, 30_medium_06, 30_medium_07, 30_medium_08, 30_medium_09, 40_one_00, 40_one_01, 40_one_02, 50_large_low_00, 50_large_low_01, 50_large_low_02, 50_large_low_03, 50_large_low_04, 60_large_high_00, 60_large_high_01, 60_large_high_02, 60_large_high_03, 60_large_high_04, 70_max_low_00, 70_max_low_01, 70_max_low_02, 70_max_low_03, 70_max_low_04, 80_max_high_00, 80_max_high_01, 80_max_high_02, 80_max_high_03, 80_max_high_04
Case Name Status Exec Time Memory
00_sample_00 AC 2 ms 640 KB
00_sample_01 AC 2 ms 640 KB
00_sample_02 AC 8 ms 640 KB
00_sample_03 AC 2 ms 640 KB
00_sample_04 AC 76 ms 640 KB
00_sample_05 AC 1911 ms 640 KB
10_small_00 AC 2 ms 640 KB
10_small_01 AC 2 ms 640 KB
10_small_02 AC 2 ms 640 KB
10_small_03 AC 2 ms 640 KB
10_small_04 AC 2 ms 640 KB
10_small_05 AC 2 ms 640 KB
10_small_06 AC 2 ms 640 KB
10_small_07 AC 2 ms 640 KB
10_small_08 AC 2 ms 640 KB
10_small_09 AC 2 ms 640 KB
20_medium_00 AC 24 ms 640 KB
20_medium_01 AC 255 ms 640 KB
20_medium_02 AC 151 ms 640 KB
20_medium_03 AC 81 ms 640 KB
20_medium_04 AC 143 ms 640 KB
20_medium_05 AC 73 ms 640 KB
20_medium_06 AC 167 ms 640 KB
20_medium_07 AC 102 ms 640 KB
20_medium_08 AC 163 ms 640 KB
20_medium_09 AC 19 ms 640 KB
30_medium_00 AC 254 ms 640 KB
30_medium_01 AC 129 ms 640 KB
30_medium_02 AC 182 ms 640 KB
30_medium_03 AC 132 ms 640 KB
30_medium_04 AC 254 ms 640 KB
30_medium_05 AC 130 ms 640 KB
30_medium_06 AC 130 ms 640 KB
30_medium_07 AC 67 ms 640 KB
30_medium_08 AC 81 ms 640 KB
30_medium_09 AC 257 ms 640 KB
40_one_00 AC 2 ms 640 KB
40_one_01 AC 2 ms 640 KB
40_one_02 AC 2 ms 640 KB
50_large_low_00 AC 270 ms 640 KB
50_large_low_01 AC 561 ms 640 KB
50_large_low_02 AC 659 ms 640 KB
50_large_low_03 AC 740 ms 640 KB
50_large_low_04 AC 798 ms 640 KB
60_large_high_00 AC 819 ms 640 KB
60_large_high_01 AC 763 ms 640 KB
60_large_high_02 AC 672 ms 640 KB
60_large_high_03 AC 615 ms 640 KB
60_large_high_04 AC 476 ms 640 KB
70_max_low_00 AC 531 ms 640 KB
70_max_low_01 AC 1200 ms 640 KB
70_max_low_02 AC 1427 ms 640 KB
70_max_low_03 AC 1626 ms 640 KB
70_max_low_04 AC 1790 ms 640 KB
80_max_high_00 AC 1912 ms 640 KB
80_max_high_01 AC 1690 ms 640 KB
80_max_high_02 AC 1530 ms 768 KB
80_max_high_03 AC 1345 ms 640 KB
80_max_high_04 AC 897 ms 640 KB