• 沒有找到結果。

In this problem you have to calculate the parity of an integer 1 ≤ I ≤ 2147483647.

N/A
N/A
Protected

Academic year: 2021

Share "In this problem you have to calculate the parity of an integer 1 ≤ I ≤ 2147483647."

Copied!
1
0
0

加載中.... (立即查看全文)

全文

(1)

10931 Parity

We define the parity of an integer n as the sum of the bits in binary representation computed modulo two. As an example, the number 21 = 10101

2

has three 1s in its binary representation so it has parity 3(mod2), or 1.

In this problem you have to calculate the parity of an integer 1 ≤ I ≤ 2147483647.

Input

Each line of the input has an integer I and the end of the input is indicated by a line where I = 0 that should not be processed.

Output

For each integer I in the inputt you should print a line ‘The parity of B is P (mod 2).’, where B is the binary representation of I.

Sample Input 1

2 10 21 0

Sample Output

The parity of 1 is 1 (mod 2).

The parity of 10 is 1 (mod 2).

The parity of 1010 is 2 (mod 2).

The parity of 10101 is 3 (mod 2).

參考文獻

相關文件

add ax,[edi] ; add an integer add edi,TYPE intarray ; point to next loop L1 ; repeat until ECX = 0 The following code calculates the sum of an array of 16-bit integers... Copying

More precisely, it is the problem of partitioning a positive integer m into n positive integers such that any of the numbers is less than the sum of the remaining n − 1

6 《中論·觀因緣品》,《佛藏要籍選刊》第 9 冊,上海古籍出版社 1994 年版,第 1

The first row shows the eyespot with white inner ring, black middle ring, and yellow outer ring in Bicyclus anynana.. The second row provides the eyespot with black inner ring

You are given the wavelength and total energy of a light pulse and asked to find the number of photons it

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =>

incapable to extract any quantities from QCD, nor to tackle the most interesting physics, namely, the spontaneously chiral symmetry breaking and the color confinement.. 

• Formation of massive primordial stars as origin of objects in the early universe. • Supernova explosions might be visible to the most