DCP-306: Even or Odd Back to All Problems

Easy Math > Number Theory


A **prime number** (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. First few prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 .... Here 2 is 1st prime number, 3 is 2nd prime number, 5 is 3rd prime number, 7 is 4th prime number and so on. In this problem, You have to figure out **the summation of N th prime number to M th prime number (Inclusive) is even or odd?** Note: ***Summation will be even if it is divisible by 2 , otherwise it will be odd.*** Input: ------ Input starts with an integer **T (0< T<=100)**, denoting the number of test cases. Each case contains two integers **N and M (1 ≤ N ≤ M ≤ 10^18)** as explained above. Output: ------- For each case of input, print **Case x: Even** if answer is even, otherwise print **Case x: Odd** Here x is the test case number. See Sample Input/Output and Explanation part for more clarifications. Sample Input ------------ 2 2 5 2 4 Sample Output ------------- Case 1: Even Case 2: Odd Explanation: In case 1, summation of 2nd prime number to 5th prime number= 3+5+7+11 =26, which is Even. In case 2, summation of 2nd prime number to 4th prime number= 3+5+7 =15, which is Odd.


Problem Setter:

Md. Amir-Al-Fahim

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 0.50
C++ 0.50
C++14 0.50
C# 0.50
Go 0.50
Java 0.50
JavaScript 0.50
Objective-C 0.50
Perl 0.50
PHP 0.50
Python 0.50
Python3 0.50
Ruby 0.50
VB.Net 0.50

Problem Stats

217/636

Solve/Submission

Ranking

# User Language Timing
01 shamimjucse Cpp14 0.00s
02 Pure_Protea Cpp14 0.00s
03 ovis96 Cpp14 0.00s
04 hrOarr Cpp14 0.00s
05 mahjabinmeem Cpp14 0.00s
06 ____ Cpp14 0.00s
07 prodipdatta7 Cpp14 0.00s
08 shahedjamil108 Cpp14 0.00s
09 OLIN Cpp14 0.00s
10 iamsadee Cpp14 0.00s
11 faceless_void Cpp14 0.00s
12 sadat999 Cpp14 0.00s
13 parishaullah Cpp14 0.00s
14 Foysol_Ahmed Cpp14 0.00s
15 madcoder Cpp14 0.00s
16 _c_k_r_ Cpp14 0.00s
17 sadmanamin Cpp14 0.00s
18 pulak_ict_mbstu Cpp14 0.00s
19 plab0n Cpp14 0.00s
20 motaleb_ICT Cpp14 0.00s
21 Masum_ice Cpp14 0.00s
22 alif_biswas Cpp14 0.00s
23 The_Viper Cpp14 0.00s
24 Najat Cpp14 0.00s
25 Koushik_12 Cpp14 0.00s
26 Islam_Rafat Cpp14 0.00s
27 fearless_hasan Cpp14 0.00s
28 milak_yn Cpp14 0.00s
29 DynamicOvi Cpp14 0.00s
30 sk_roy Cpp14 0.00s
31 booleancode01 Cpp14 0.00s
32 aseem_cu Cpp14 0.00s
33 bishal_biswas Cpp14 0.00s
34 maxhasan Cpp14 0.00s
35 showmic Cpp14 0.00s
36 _dipu Cpp14 0.00s
37 mbstu_alamin16 Cpp14 0.00s
38 Zayed Cpp14 0.00s
39 waqqas Cpp14 0.00s
40 Bruteforcekid Cpp14 0.00s
41 cse_nazmul Cpp14 0.00s
42 AnamikaAhmed Cpp14 0.00s
43 Dark_Ocean Cpp14 0.00s
44 nymphaea Cpp14 0.00s
45 joy25896 Cpp14 0.00s
46 ittehad Cpp14 0.00s
47 SamiulSourav Cpp14 0.00s
48 Shadman87 Cpp14 0.00s
49 prottoy919 Cpp14 0.00s
50 prantacse14 Cpp14 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support