Category Archives: URI Online Judge

URI Online Judge Solution | 1035 Selection Test 1

Hints: Don’t forget to think that A is even so we have to use a%2==0 that’s it


URI Online Judge Solution | 1020 Age in Days

Just think simple
if we take age input then if we want year then we have to divide the age with year,then if we want to find out the age in month as 1 year is 365 and 30 days of 12 months then we have to remainder and resultant value divided by 30 and at last for days of age we have to use remainder of 356 days and remainder of 30 respectively as 365 days for 1 year and 30 days for 1 months


URI Online Judge Solution| 1019 Time Conversion

Input format=integer
Output format=hours:minutes:seconds
1 minute =60 second
1hour = 60minute

1min = 60 second
60 min = 60*60=3600 seconds

3600 second=1hour
1 second=1/3600 hour
556 second=556*1/3600 hour

3600 second =60 minute
1 second = 60/3600 minute
556 second = 60/3600 * 556 minute
Here, in this case in finding minute we also have to use remainder because it is the portionate part of hour so the formula will be n%3600*60

556 second = 556 % 60 because second is the part of seconds and we want to find out the seconds so in this case we have to use remainder


URI Online Judge Solution | 1017 Fuel spent

Here is the given hint is
“the amount of liters of fuel spent on a trip, using a car that does 12 Km/L”
and “This way you can get distance”
And I have to take input spent 10 hours and average velocity 85km/h so the formula for how many litre fuel spent in this path is c=85*10/12 We actually got this by using unitary method 🙂


URI Online Judge Solution| 1014 Consumption

Solution:Though car consumption means that desribe here’s broadly

The following formula is used to calculate fuel consumption in litres / 100kms, the most commonly used measure of fuel consumption.

Example a car uses 65 litres to travel 500km

(65 X 100) / 500 = 13

(Litres used X 100) / km travelled = Litres per 100km.


but in the problem it is saying that medium of the car consumption with 3 digit after the decimal point so we have just divided the integer x and float y and got the answer. 🙂


URI Online Judge Solution | 1013 The Greatest

I have took help from net.And after taking a look I understood what to do actually.

Here for each test case I have to use this formula

After using MaiorAB that means in portugese and in english by google translating i have find it is maximum or larger or more in AB
So in Maior is in MaiorAB and in from the input C


URI Online Judge Solution| 1012 Area

Don’t use float as in the problem it is said to use double
And hrere i have used End of file using while(scanf()==) loop

that means for 3 input i have given while(scanf(“%lf %lf %lf”,&a,&b,&c)==3)


URI Online Judge Solution| 1011 Sphere

Problem Link:

I first tried to do with float but it was not giving me correct answer for 3rd test case so i have searched in the net for solution the i have seen that i have to use double as double is for 8 byte where as float was for 4 byte

So i have used float and result is correct upto all test cases 🙂


URI Online Judge | 1010 Simple Calculate

Here I have used array and for loop and defines the array index inside the for loop and while adding the output there i have added the value from array index



URI Online Judge Solution | 1009 Salary with Bonus


Solution:First I thought it is about gross margin but after searching in net i have come to the point that it is not about this but it is very simple…I am sharing this now
Here two hints for the solution of this problem
1.Your functionary wins 15% over all products sold
that means you have to multiply with 15 with sold products and divide by 100 as here is percentage

2.Final or Total salary means that you have to add salary i give to him(my employee)+15% of solded products because functionary means employee and he wins 15% of all solded products

That’s all so code is here..

URI Online Judge Solution| 1007 Difference



URI Online Judge Solution | 1006 Average 2



It also use weighted average/mean
You can check this link for weighted mean

Weighted Mean =   Σwx


URI Online Judge Solution| 1005 Average 1



It actually use weighted average/mean
You can check this link for weighted mean


URI Online Judge Solution | 1004 Simple Product

Solution: Here calculate the product means multiplication.So i have made multiplication with mul variable

URI Online Judge Solution | 1002 Area of a Circle

Problem Link:
You have to work here with double %lf because if you use float %f for floating point values then it will never give you the accurate answer given in the question output and atlast don’t forget to give newline/endline in the output line otherwise it will show you presentation error.