Submission #1924651


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define L 100001
long q;
vector < int > tmp(L,1);
void init()
{
    long i,j;
    for (i=2;i<=sqrt(L);i++)
        if (tmp[i])
            for (j=2*i;j<L;j+=i)
                tmp[j]=0;
    tmp[0]=tmp[1]=0;
}
void solve()
{
    while(q--)
    {
        long i,l,r,ans=0;
        scanf("%ld%ld",&l,&r);
        for (i=l;i<=r;i+=2)
            if (tmp[i]&&tmp[(i+1)/2]) ans++;
        printf("%ld\n",ans);
    }
}
int main()
{
    init();
    while(~scanf("%ld",&q))
        solve();
}

Submission Info

Submission Time
Task A - New Year
User wahahawa
Language C++14 (GCC 5.4.1)
Score 0
Code Size 559 Byte
Status RE
Exec Time 99 ms
Memory 640 KB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
RE × 2
RE × 8
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt RE 96 ms 640 KB
02.txt RE 97 ms 640 KB
03.txt RE 99 ms 640 KB
04.txt RE 99 ms 640 KB
05.txt RE 99 ms 640 KB
06.txt RE 98 ms 640 KB
sample_01.txt RE 98 ms 640 KB
sample_02.txt RE 98 ms 640 KB