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

212/622

Solve/Submission

Ranking

# User Language Timing
01 njrafi Cpp14 0.00s
02 cse_nazmul Cpp14 0.00s
03 atik Cpp14 0.00s
04 asiuzzaman006 Cpp14 0.00s
05 KNUTH Cpp14 0.00s
06 alhelal_cse Cpp 0.00s
07 Koushik_12 Cpp14 0.00s
08 ifat_just Cpp14 0.00s
09 inactivecoder Cpp14 0.00s
10 shailyroy Cpp14 0.00s
11 Dark_Ocean Cpp14 0.00s
12 taskin1995 Cpp14 0.00s
13 Zayed Cpp14 0.00s
14 aseem_cu Cpp14 0.00s
15 foysal_007 Cpp14 0.00s
16 Alamgir_Hossain Cpp14 0.00s
17 Nazmul_Moon Cpp14 0.00s
18 yakin Cpp14 0.00s
19 Nazmul_WUB Cpp14 0.00s
20 asad_IT Cpp14 0.00s
21 Shakil_Mahmud Cpp14 0.00s
22 showmic Cpp14 0.00s
23 zyyxxx Cpp14 0.00s
24 Optimus_primeV2 Cpp14 0.00s
25 shawon100 Cpp14 0.00s
26 zitul_mahmud Cpp14 0.00s
27 emrul Cpp14 0.00s
28 Foysol_Ahmed Cpp14 0.00s
29 tariqiitju Cpp 0.00s
30 sazal_dev Cpp14 0.00s
31 Najat Cpp14 0.00s
32 n433m Cpp14 0.00s
33 SM_Roknuzzaman Cpp14 0.00s
34 arabin C 0.00s
35 plab0n Cpp14 0.00s
36 shamimjucse Cpp14 0.00s
37 t0whid Cpp14 0.00s
38 Pure_Protea Cpp14 0.00s
39 maxhasan Cpp14 0.00s
40 Masum_ice Cpp14 0.00s
41 mhiceiu Cpp14 0.00s
42 prodipdatta7 Cpp14 0.00s
43 joy25896 Cpp14 0.00s
44 The_Viper Cpp14 0.00s
45 milak_yn Cpp14 0.00s
46 Aman_khan Cpp14 0.00s
47 fearless_hasan Cpp14 0.00s
48 rayhan50001 Cpp14 0.00s
49 Logic_Hunter Cpp14 0.00s
50 nazmul49 Cpp14 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support