Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class Picnic
- {
- //Students from 5th class decided to make a picnic. Each class had to buy something.
- //And Teddy is dropped to provide soft drink. However,
- //it is difficult for how to buy bottles of soda for all students,
- //if every child drink - 2 cups of 200 ml.
- //Write a program piknik, which calculates how many bottles to buy Teddy
- //Input
- //From the standard input is read three integers k, l and ml. k – number of students,
- //l and lm – capacity of one bottle of soft drink.
- //Exit
- //The standard output displays one number - the number of bottles of soda that Teddy will buy.
- static void Main(string[] args)
- {
- int k = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int ml = int.Parse(Console.ReadLine());
- if(k < 1 || k > 26 || l > 20 || l < 0 || ml < 0 || ml > 1000){
- return;
- }
- double val = Convert.ToDouble(ml) / 1000;
- val += Convert.ToDouble(l);
- double answer = 0;
- answer = (Convert.ToDouble(k) * 0.4) / val;
- if (answer != Math.Round(answer))
- {
- answer = Math.Floor(answer) + 1;
- }
- Console.WriteLine(Convert.ToInt32(answer));
- }
- }
Add Comment
Please, Sign In to add comment