C++ Competition Daily Problem – Day 852

Today is the 852nd day of learning programming with a slightly cold rain!

Hello, everyone! This is the problem from the CSP-J2025 Preliminary Round.

Day 852

C++ Competition Daily Problem - Day 852C++ Competition Daily Problem - Day 852

CSP2025-J Preliminary Round

2. In C++, what is the output of the following code: int x=255; cout<<(x&(x-1));?

C++ Competition Daily Problem - Day 852

Answer: B

START OF SPRING

The explanation: First, from the conclusion perspective, the operation x&(x-1) clears the rightmost 1 in the binary representation of x. Therefore, the result is 254.

C++ Competition Daily Problem - Day 852

20

25

9

C++ Competition Daily Problem - Day 852

SEPTEMBER

Day

Mon

Tue

Wed

Thu

Fri

Sat

1

10

2

11

3

Victory Day of the War of Resistance

4

13

5

14

6

Ghost Festival

7

White Dew

8

17

9

18

10

Teachers’ Day

11

20

12

21

13

22

14

23

15

24

16

25

17

26

18

September 18 Incident

19

28

20

29

21

30

22

August

23

Autumn Equinox

Harvest Festival

24

3

25

4

26

5

27

6

28Class

7

29

8

30

Martyrs’ Memorial Day

@秀米XIUMI

With a slightly cold rain

Open Wisdom Station

C++ Competition Daily Problem - Day 852

Leave a Comment