CF1786A1.Non-alternating Deck (easy version)
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is an easy version of the problem. In this version, all cards have the same color.
Alice has n cards, each card is white, and the cards are stacked in a deck. Alice deals the cards to herself and to Bob, dealing at once several cards from the top of the deck in the following order: one card to herself, two cards to Bob, three cards to Bob, four cards to herself, five cards to herself, six cards to Bob, seven cards to Bob, eight cards to herself, and so on. In other words, on the i-th step, Alice deals i top cards from the deck to one of the players; on the first step, she deals the cards to herself and then alternates the players every two steps. When there aren't enough cards at some step, Alice deals all the remaining cards to the current player, and the process stops.
First Alice's steps in a deck of many cards.
How many cards will Alice and Bob have at the end?
这是一个该问题的简单版本。在此版本中,所有卡片颜色相同。
爱丽丝有 n 张卡片,每张卡片均为白色,且这些卡片以叠放形式构成一副牌。爱丽丝将卡片依次发给自己和鲍勃:每次从牌顶一次性发出若干张牌,发牌顺序如下:第 1 张给爱丽丝,接下来 2 张给鲍勃,接下来 3 张给鲍勃,接下来 4 张给爱丽丝,接下来 5 张给爱丽丝,接下来 6 张给鲍勃,接下来 7 张给鲍勃,接下来 8 张给爱丽丝,依此类推。换言之,在第 i 步中,爱丽丝从牌顶发出 i 张牌给其中一位玩家;第一步发给爱丽丝,之后每两步轮换一次发牌对象。当某一步剩余卡片不足 i 张时,爱丽丝将剩余所有卡片全部发给当前应接收的玩家,过程随即终止。
一副大量卡片的牌堆中,爱丽丝最初的几步发牌示意图。
最终,爱丽丝和鲍勃各自将获得多少张卡片?
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤200). The description of the test cases follows
The only line of each test case contains a single integer n (1≤n≤106) — the number of cards.
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤200)。随后是测试用例的描述。
每个测试用例仅有一行,包含一个整数 n(1≤n≤106)—— 卡片的数量。
输出格式
For each test case print two integers — the number of cards in the end for each player — in this order: cards Alice has, cards Bob has.
对于每个测试用例,输出两个整数——即最终每位玩家所拥有的卡片数量——顺序为:Alice 拥有的卡片数、Bob 拥有的卡片数。
输入输出样例
输入#1
5 10 6 17 8 1000000
输出#1
5 5 1 5 10 7 3 5 500202 499798
输入解题思路,AI测评打分。不知道怎么写?