2242 - I2P(II) 2020_Chen_final_practice Scoreboard

Time

2021/01/05 23:59:00 2021/01/14 18:40:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12674 Eat candies
12678 Count 1s
12797 Unlimited Triangle Work

12674 - Eat candies   

Description

You have three different kinds of candies: color red, color green, color blue.

You got three number r, g, b which means the number of candies for each color.

You need to eat exactly two candies each day.

The candies you eat have to be different colors.

Your goal is to find out what's the maximum days that you can eat the candies that qualified for the rules above.

 

Example:

if r = 7, g = 4, b = 10

You can eat green and blue for 4 days, then you got r = 7, g = 0, b = 6.

Then you can eat red and blue for 6 days, then you got r = 1, g = 0, b = 0.

There's only one red left, you can't have two candies anymore.

The answer will be 10 days.

Input

The input first contains one integer t( 1 <= t <= 10^6) which means the number of testcases.

The following t lines each line contains three integer r, g, b(0 <= r, g, b <= 10^8)

 

Output

For each testcase print a integer which means the maximum days that you can eat the candies.

Remember to print \n at the end of each output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12678 - Count 1s   

Description

Given two number a,b.

You need to calculate how many 1 appear in range a~b(decimal representation).

 

 

 

Example:

Given a = 1, b = 11.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

There're four 1 appear in range 1~11(1, 10, 11).

The answer is 4.

 

 

 

Input

First line contains one integer t(1 <= t <= 10^6) which means the number of testcases.

The following t lines, each line contains two integer a, b( 1 <= a <= b <= 10^6)

 

Output

For each testcase print only one number which means the number of 1 appear in range a~b.

Remember to print \n at the end of output.

Sample Input  Download

Sample Output  Download

Tags

123 456 666 9487 59420



Discuss




12797 - Unlimited Triangle Work   

Description

Recently, Gilgamesh found that he's almost lack of swords in his vault, so he wants to forge a lot of swords with different shapes. He command you to forge for him!

Gilgamesh's sword can only be forged by triangle. Different triangle can be forged into a unique sword. He will give you the intervals of the edges of triangles, you have to calculate how many swords with different shape can he get?

king

Gilgamesh threats you with his "Gate of Babylon".


You are given four positive integer , you're going to count how many triangle that can be build by edges with length , where .

For example:

You can build triangles with edges : .

So the answer is 4.

Input

The first line contains one integer , there are testcases below.

For each testcase, the four integer is given respectively.

.

.

Output

For each testcase, output its answer, followed by a newline character.

Sample Input  Download

Sample Output  Download

Tags




Discuss