Nội dung Bài tập
- Mã:
- ACM2016_North_F
- Tên:
- Memorize lookalike cards (ACM 2016 Miền Bắc)
- Dạng thi:
- acm
- Thang điểm:
- 1 điểm
- Giới hạn thời gian:
- 2 giây
- Giới hạn bộ nhớ:
- 64 MB
- Được tạo bởi:
- admin
Memorize lookalike cards is a fun children-friendly card game. Ti and Teo are playing this game.
The game is played with a deck of 2N cards. There are N pairs of cards, each pair consists of 2 lookalike cards and is different from other pairs. The game starts with shuffling the deck and lay all the card face down on a table, so that you can not determine which cards are in the same pair.
Ti and Teo takes alternate turns and Ti will take the first turn. In each turn, the player
will choose 2 cards and turn them face up simultaneously.
Ti and Teo are very intelligent kid and also have incredible memory. They will always optimal (so that his point is maximized). Can you calculate the expected value of Ti's point?
Input
Quảng cáo
The game is played with a deck of 2N cards. There are N pairs of cards, each pair consists of 2 lookalike cards and is different from other pairs. The game starts with shuffling the deck and lay all the card face down on a table, so that you can not determine which cards are in the same pair.
Ti and Teo takes alternate turns and Ti will take the first turn. In each turn, the player
will choose 2 cards and turn them face up simultaneously.
• If the 2 cards are look alike, they will be removed from the deck and the player will get 1 point.The game ends when there is no face down card left or the number of turns exceed 10100.
• If the 2 cards are not look alike, the player will turn them face down and put back to the deck.
Ti and Teo are very intelligent kid and also have incredible memory. They will always optimal (so that his point is maximized). Can you calculate the expected value of Ti's point?
Input
The input starts with the number of test - T (T ≤ 1000). Then T tests follow. Each test consists of a single integer N. (N ≤ 1000)Output
For each test in the input, print the expected point of Ti in a single line. The number should be printed with exactly 3 digit after decimal.Sample
input2
1
2output1.000
1.000
Theme :
Mời bạn soạn code
Ai có thể xem bài này :
Thông tin
Phần thảo luận