CF1217A.Creating a Character

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You play your favourite game yet another time. You chose the character you didn't play before. It has strstr points of strength and intint points of intelligence. Also, at start, the character has expexp free experience points you can invest either in strength or in intelligence (by investing one point you can either raise strength by 11 or raise intelligence by 11).

Since you'd like to make some fun you want to create a jock character, so it has more strength than intelligence points (resulting strength is strictly greater than the resulting intelligence).

Calculate the number of different character builds you can create (for the purpose of replayability) if you must invest all free points. Two character builds are different if their strength and/or intellect are different.

你又一次玩起了自己最喜欢的游戏。这次你选择了一个之前从未使用过的角色。该角色初始拥有 strstr 点力量(strength)和 intint 点智力(intelligence)。此外,角色初始还拥有 expexp 点自由经验点数(free experience points),你可以将这些点数全部分配给力量或智力(每投入 1 点经验,可使力量或智力增加 1 点)。

由于你想体验一些乐趣,因此希望创建一个“运动健将”(jock)型角色,即最终的力量值严格大于智力值(即:最终力量 > 最终智力)。

在必须用完所有自由经验点的前提下,请计算你能创建的不同角色构建(character builds)的数量(以提升游戏的重玩价值)。若两个角色构建的力量值和/或智力值不同,则认为它们是不同的构建。

输入格式

The first line contains the single integer TT (1≤T≤1001 \le T \le 100) — the number of queries. Next TT lines contain descriptions of queries — one per line.

This line contains three integers strstr, intint and expexp (1≤str,int≤1081 \le str, int \le 10^8, 0≤exp≤1080 \le exp \le 10^8) — the initial strength and intelligence of the character and the number of free points, respectively.

第一行包含一个整数 TT(1≤T≤1001 \le T \le 100),表示查询次数。接下来的 TT 行每行描述一个查询。

每行包含三个整数 strstr、intint 和 expexp(1≤str,int≤1081 \le str, int \le 10^8,0≤exp≤1080 \le exp \le 10^8),分别表示角色的初始力量值、智力值以及可用的自由点数。

输出格式

Print TT integers — one per query. For each query print the number of different character builds you can create.

输出 TT 个整数——每个查询对应一个整数。对于每个查询,输出你可以创建的不同角色构建的数量。

输入输出样例

  • 输入#1

    4
    5 3 4
    2 1 0
    3 5 5
    4 10 6

    输出#1

    3
    1
    2
    0

说明/提示

In the first query there are only three appropriate character builds: (str=7,int=5)(str = 7, int = 5), (8,4)(8, 4) and (9,3)(9, 3). All other builds are either too smart or don't use all free points.

In the second query there is only one possible build: (2,1)(2, 1).

In the third query there are two appropriate builds: (7,6)(7, 6), (8,5)(8, 5).

In the fourth query all builds have too much brains.

在第一次查询中,仅有三种合适的角色构建:(str=7,int=5)(str = 7, int = 5)、(8,4)(8, 4) 和 (9,3)(9, 3)。所有其他构建要么智力过高,要么未用尽全部自由点数。

在第二次查询中,仅存在一种可能的构建:(2,1)(2, 1)。

在第三次查询中,存在两种合适的构建:(7,6)(7, 6) 和 (8,5)(8, 5)。

在第四次查询中,所有构建的智力均过高。

输入解题思路,AI测评打分。不知道怎么写?

首页