 # PROBSUB - Editorial

Contest

Author: thvardhan

Tester: thvardhan

cakewalk

nothing

### PROBLEM:

You have to calculate the percent chance of getting a diamond out of coal and gold.

### QUICK EXPLANATION:

we simply do

``````double total=gold+diamond+coal;
if(total!=0){
double diamondChance=100*(diamond/total);
``````

and print it.

### EXPLANATION:

To calculate the percentage we first calculate the total items present by adding them all.

``````	double total=gold+diamond+coal;
``````

now we just check if its 0 if true we will print “No” else we calculate it.

``````	if(total!=0){
double diamondChance=100*(diamond/total);
``````

now we simply check if the chance is more than 50 if it is then we print “Yes” else “No”

``````	if(diamondChance>50)
{System.out.println("Yes");}
else
{System.out.println("No");}
``````

### AUTHOR’S SOLUTION:

author’s solution can be found here

t= int(input())
t-=1

g,d,c = list(map(int , input().split()))

total = g+d+c

chance = 100*(d/total)

if chance <= 50:
print(‘NO’)

wtats wring with my code im getting RUNTIME error

else:

``print('YES')``