CodeForces - 1593A Elections

Posted 海岛Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CodeForces - 1593A Elections相关的知识,希望对你有一定的参考价值。

A. Elections
time limit per test 1 second
memory limit per test 256 megabytes

The elections in which three candidates participated have recently ended. The first candidate received a votes, the second one received b votes, the third one received c votes. For each candidate, solve the following problem: how many votes should be added to this candidate so that he wins the election (i.e. the number of votes for this candidate was strictly greater than the number of votes for any other candidate)?

Please note that for each candidate it is necessary to solve this problem independently, i.e. the added votes for any candidate do not affect the calculations when getting the answer for the other two candidates.

Input
The first line contains one integer t (1≤t≤104) — the number of test cases. Then t test cases follow.

Each test case consists of one line containing three integers a, b, and c (0≤a,b,c≤109).

Output
For each test case, output in a separate line three integers A, B, and C (A,B,C≥0) separated by spaces — the answers to the problem for the first, second, and third candidate, respectively.

Example
input
5
0 0 0
10 75 15
13 13 17
1000 0 0
0 1000000000 0
output
1 1 1
66 0 61
5 5 0
0 1001 1001
1000000001 0 1000000001

问题链接CodeForces - 1593A Elections
问题简述:(略)
问题分析:(略)

AC的C语言程序如下:

/* CodeForces - 1593A Elections */

#include <stdio.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))

int main()

    int t, a, b, c;
    scanf("%d", &t);
    while (t--) 
        scanf("%d%d%d", &a, &b, &c);

        printf("%d %d %d\\n", MAX(0, MAX(b, c) + 1 - a),
               MAX(0, MAX(a, c) + 1 - b),
               MAX(0, MAX(a, b) + 1 - c));
    

    return 0;

以上是关于CodeForces - 1593A Elections的主要内容,如果未能解决你的问题,请参考以下文章

codeforces上怎么看测试数据

如何看codeforces做了多少题

codeforces上怎么看测试数据

codeforces比赛后怎么看题解和答案

codeforces是啥?

codeforces Codeforces 650A Watchmen