CF2145A.Candies for Nephews
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Monocarp has three nephews. New Year is coming, and Monocarp has n candies that he will gift to his nephews.
To ensure that none of the nephews feels left out, Monokarp wants to give each of the three nephews the same number of candies.
Determine the minimum number of candies that Monocarp needs to buy additionally so that he can give each of the three nephews the same number of candies. Note that all n candies that Monocarp initially has will be given to the nephews.
莫诺卡普有三个侄子。新年即将到来,莫诺卡普有 n 颗糖果,他打算将这些糖果送给他的侄子们。
为了确保没有一个侄子感到被冷落,莫诺卡普希望给每个侄子相同数量的糖果。
请确定莫诺卡普需要额外购买的最少糖果数量,使得他能将所有糖果(包括额外购买的)平均分给三个侄子。注意:莫诺卡普最初拥有的全部 n 颗糖果都必须分给侄子们。
输入格式
The first line contains an integer t (1≤t≤100) — the number of test cases.
Each test case consists of one line containing one integer n (1≤n≤100) — the number of candies that Monocarp initially has.
第一行包含一个整数 t(1≤t≤100)—— 测试用例的数量。
每个测试用例由一行组成,该行包含一个整数 n(1≤n≤100)—— Monocarp 最初拥有的糖果数量。
输出格式
For each test case, print one integer — the minimum number of candies that Monocarp needs to buy additionally so that he can give each of the three nephews the same number of candies.
对于每个测试用例,输出一个整数——Monocarp 需要额外购买的最少糖果数量,以便他能给三个侄子每人分发相同数量的糖果。
输入输出样例
输入#1
2 7 24
输出#1
2 0
说明/提示
In the first example, Monocarp needs to buy 2 candies. After that, he will have 9 candies, and he can give each of the three nephews 3 candies.
In the second example, Monocarp does not need to buy any candies, as he initially has 24 candies, and he can give each of the three nephews 8 candies.
在第一个例子中,Monocarp 需要购买 2 颗糖果。之后,他将拥有 9 颗糖果,并可以给每位侄子各 3 颗糖果。
在第二个例子中,Monocarp 无需购买任何糖果,因为他最初已有 24 颗糖果,并可以给每位侄子各 8 颗糖果。
输入解题思路,AI测评打分。不知道怎么写?