Classic
Clean & simple
Crystal
Glassmorphism + Neon
Cyberpunk
Neon glitch art
🚫
违规Action检测
禁止Use右键菜单
⚠️ 此Action已被系统记录
1

Card Game

📝 Solutions 🔵 仅限 C++
Problems Description
<p><span style="font-size: large;"><span style="font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Joe is playing a card game. There is a pile of cards numbered 1, 2, ... n from top to bottom. Every time Joe throws away the top card and puts the second card to the bottom, until there is only one card. Can you tell Joe the number of the last card?<br /> </span></span></p>
Input格式
<p><span style="font-size: large;"><span style="font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There are multiple test cases (no more than 1000). Each test case contains only one integer n (1 &lt;= n &lt;= 10^6), the number of cards.<br /> </span></span></p>
Output格式
<p><span style="font-size: large;"><span style="font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There is only one line for each test case, containing the last card's number.<br /> </span></span></p>
Sample
Sample Input 1
3 6 10
Sample Output 1
2 4 4
Submit Code
请先Login后Submit

🤖 AI 解题助手

OpenRouter
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这problems题,可以帮你points析思路、提供Code示例。
🔓 完全Free · 无需消耗 Token