Submission #10230940
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define ll long long const int MAX = 1e5 + 10; int prime[MAX], tag[MAX]; void is_Prime(){ int cnt = 0; prime[++cnt] = 2; tag[1] = 1; for( int i = 2; i < MAX; i++){ if(!tag[i]) prime[++cnt] = i; for(int j = 1; j <= cnt && i * prime[j] < MAX; j++){ tag[i * prime[j]] = 1; if( i % prime[j] == 0) break; } } } int main(){ int t, l, r, num = 0; is_Prime(); cin >> t; while(t--){ scanf("%d%d", &l, &r); for( int i = l; i <= r; i++){ if(!tag[i] && !tag[( i + 1) / 2]) num++; } cout << num << endl;; num = 0; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 2017-like Number |
User | luogu_bot3 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 641 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 768 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:25:24: 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 | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 2103 ms | 768 KB |
02.txt | TLE | 2103 ms | 768 KB |
03.txt | TLE | 2103 ms | 768 KB |
04.txt | TLE | 2103 ms | 768 KB |
05.txt | TLE | 2103 ms | 768 KB |
06.txt | TLE | 2103 ms | 640 KB |
07.txt | TLE | 2103 ms | 768 KB |
sample_01.txt | AC | 2 ms | 640 KB |
sample_02.txt | AC | 2 ms | 640 KB |
sample_03.txt | AC | 2 ms | 640 KB |