Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Read input data /////////////// NAKOV
- decimal X = decimal.Parse(Console.ReadLine());
- decimal Y = decimal.Parse(Console.ReadLine());
- // Solve the problem
- if (X == 0 && Y == 0)
- {
- Console.WriteLine(0);
- }
- else if (X == 0)
- {
- Console.WriteLine(5);
- }
- else if (Y == 0)
- {
- Console.WriteLine(6);
- }
- else if (X > 0 && Y > 0)
- {
- Console.WriteLine(1);
- }
- else if (X < 0 && Y > 0)
- {
- Console.WriteLine(2);
- }
- else if (X < 0 && Y < 0)
- {
- Console.WriteLine(3);
- }
- else // if (X > 0 && Y < 0)
- {
- Console.WriteLine(4);
- }
- 1/////////////////////////////////////////////////////////////////////////kgkgkgkghkytueuywsr
- string year = Console.ReadLine();
- double p = double.Parse(Console.ReadLine());
- double h = double.Parse(Console.ReadLine());
- double allweekends = 52;
- double normalweekends = (allweekends - h) * 2 / 3;
- double totalholydays = p / 2;
- double result = h + normalweekends + totalholydays;
- if (year == "t")
- {
- result = result + 3;
- }
- result = Math.Floor(result);
- Console.WriteLine(result);
- 2//////////////////////////////////////////////////////////////////////////////////////////////////////////////
- string year = Console.ReadLine();
- double p = double.Parse(Console.ReadLine());// holydasy
- double h = double.Parse(Console.ReadLine());// hometown
- double allWeekEnds = 48;
- double normalWeekEnds = (allWeekEnds - h) * 3 / 4;
- double holidays = p * 2 / 3;
- double result = h + normalWeekEnds + holidays;
- if (year == "leap")
- {
- result = result + (result * 15 / 100);
- }
- Console.WriteLine((int)result);
- 3 ///////////////////////////////////////////////////////////////////////////
- int projectHours = int.Parse(Console.ReadLine());
- double days = double.Parse(Console.ReadLine());
- double productivity = double.Parse(Console.ReadLine());
- double workHours = days - (days / 100 * 10);
- workHours *= 12;
- workHours *= productivity / 100;
- workHours = Math.Floor(workHours);
- int completeProjectHours = (int)(workHours - projectHours);
- if (completeProjectHours < 0)
- {
- Console.WriteLine("No\n{0}", completeProjectHours);
- }
- else
- {
- Console.WriteLine("Yes\n{0}", completeProjectHours);
- }
- //"Yes\n{0}"- \n e za nov red da pechata na sledvashtiqt red
- 4//////////////////////////////////////////////////////////////////////////////////////////////////
- string ticketType = Console.ReadLine();
- int row = int.Parse(Console.ReadLine());
- int col = int.Parse(Console.ReadLine());
- int ticketCount = row * col;
- double ticketPrice = 0;
- switch (ticketType)
- {
- case "Premiere":
- ticketPrice = 12.00;
- break;
- case "Normal":
- ticketPrice = 7.50;
- break;
- default:
- ticketPrice = 5.00;
- break;
- }
- double profit = ticketPrice * ticketCount;
- Console.WriteLine("{0:F2} leva", profit);
- }
- 5//////////////////////////////////////////////////////////////////////////////////////////////
- int ax = int.Parse(Console.ReadLine());
- int ay = int.Parse(Console.ReadLine());
- int bx = int.Parse(Console.ReadLine());
- int by = int.Parse(Console.ReadLine());
- int cx = int.Parse(Console.ReadLine());
- int cy = int.Parse(Console.ReadLine());
- double a = Math.Sqrt(Math.Pow((cx - bx),2)+Math.Pow((cy - by),2));
- double b = Math.Sqrt(Math.Pow((cx - ax),2)+Math.Pow((cy - ay),2));
- double c = Math.Sqrt(Math.Pow((bx - ax),2)+Math.Pow((by - ay),2));
- if(a + c > c && a + c > b && b + c > a)
- {
- double p = (a + b + c) / 2;
- double area = Math.Sqrt(p*(p-a)*(p-b)*(p-c));
- Console.WriteLine("Yes");
- Console.WriteLine("{0:f2}", area);
- }
- else
- {
- Console.WriteLine("No");
- c = Math.Round(c,2); // tova e dr variant da zakruglqm do 2 znam ako napisha 3 she go zakrugli do 3 znak
- Console.WriteLine("{0:0.00}", c);
- }
- }
- // "{0:0.00}" za da izkara kogato ima 0 zashtoto kato go
- // 0,00 kogato ima 0 zashtoto kato go slojim C i e 0
- // trqbva da e 0,00 {"0:##"} za da vadi samo 00
- 6/////////////////////////////////////////////////////////////////////////////////////////////////
- int startHour = int.Parse(Console.ReadLine());
- int startMinutes = int.Parse(Console.ReadLine());
- int startSeconds = int.Parse(Console.ReadLine());
- string partOfDay = Console.ReadLine();
- int duratationHour = int.Parse(Console.ReadLine());
- int duratationMinutes = int.Parse(Console.ReadLine());
- int duratationSeconds = int.Parse(Console.ReadLine());
- if (partOfDay == "PM")
- {
- startHour += 12;
- if (startHour == 24)
- {
- startHour = 0;
- }
- }
- // moi nachin s Add.Seconds
- DateTime startTime =
- new DateTime(2014, 01, 01, startHour, startMinutes, startSeconds);
- DateTime endTime = startTime.AddHours(duratationHour).AddMinutes(duratationMinutes).AddSeconds(duratationSeconds);
- Console.WriteLine("{0:hh:mm:ss:tt}", endTime);
- 7////////////////////////////////////////////////////////////////////////////////////////////////////////
- string dayofWeek = Console.ReadLine();
- double sum = 0;
- for (int i = 0; i < 3; i++)
- {
- double tempQuantity = double.Parse(Console.ReadLine());
- string temoProduct = Console.ReadLine();
- double price = 0;
- bool isFruit = false;
- bool vegeta = false;
- switch (temoProduct)
- {
- case "banana":
- {
- price = 1.80;
- isFruit = true;
- }
- break;
- case "cucumber":
- {
- price = 2.75;
- vegeta = true;
- }
- break;
- case "tomato":
- {
- price = 3.20;
- vegeta = true;
- }
- break;
- case "orange":
- {
- price = 1.60;
- isFruit = true;
- }
- break;
- case "apple":
- {
- price = 0.86;
- isFruit = true;
- }
- break;
- }
- //// tuk smqtame cenata na produkta I kolichestvoto
- double value = price * tempQuantity;
- switch (dayofWeek)
- {
- case "Friday":
- {
- value = 0.90 * value;
- }
- break;
- case "Sunday":
- ////////// produljenie na FRUIT MARKET 7 variant
- {
- value = 0.95 * value;
- }
- break;
- case "Tuesday":
- {
- if (isFruit == true)
- {
- value = 0.8 * value;
- }
- }
- break;
- case "Wednesday":
- {
- if (vegeta == true) // moje i isFruit == false
- {
- value = 0.9 * value;
- }
- //// if (!isFruit) // moje i isFruit == false
- // // {
- // // value = 0.9 * value;
- //// }
- }
- break;
- case "Thursday":
- {
- if (temoProduct == "banana")
- {
- value = 0.70 * value;
- }
- }
- break;
- }
- //// i tuk subiram value ot razli4nite dni s namalenie i go vurtim 3 puti kolkoto e cikala za 3te produkta
- sum = sum + value;
- }
- Console.WriteLine("{0:f2}", sum);
- }
- 8////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- int h = int.Parse(Console.ReadLine()); /// h mi e size nafigurata primer 2 ili 15
- for (int i = 0; i < 5; i++)
- {
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- bool box1 = ((x >= h && x <= 2 * h) && (y >= h && y <= 4 * h));
- bool box2 = ((x >= 0 && x <= 3 * h) && (y >= 0 && y <= h));
- if (box1 || box2)
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- // dr izpisvane bez bool promenlivi
- // probvah s 2 IF no nqma kaka da s epolu4i taka zashtoto
- // figurata ne e cqla i mi izpisva po 2 puti inside ili outside
- /* if (((x >= h && x <= 2 * h) && (y >= h && y <= 4 * h)) ||
- ((x >= 0 && x <= 3 * h) && (y >= 0 && y <= h)))
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- } */
- }
- ///////////////////////
- // moje i 3 variant 5 if / else kato proverqvame za vsqko edno
- // primerno x1 polse za x2 i taka do x5
- /* int h = int.Parse(Console.ReadLine());
- int x1 = int.Parse(Console.ReadLine());
- int y1 = int.Parse(Console.ReadLine());
- if (((x1 >= h && x1 <= 2 * h) && (y1 >= h && y1 <= 4 * h)) ||
- ((x1 >= 0 && x1 <= 3 * h) && (y1 >= 0 && y1 <=h)))
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- int x2 = int.Parse(Console.ReadLine());
- int y2 = int.Parse(Console.ReadLine());
- if (((x2 >= h && x2 <= 2 * h) && (y2 >= h && y2 <= 4 * h)) ||
- ((x2 >= 0 && x2 <= 3 * h) && (y2 >= 0 && y2 <= h)))
- {
- ///////// PRODULJENIE NA 8 variant
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- int x3 = int.Parse(Console.ReadLine());
- int y3 = int.Parse(Console.ReadLine());
- if (((x3 >= h && x3 <= 2 * h) && (y3 >= h && y3 <= 4 * h)) ||
- ((x3 >= 0 && x3 <= 3 * h) && (y3 >= 0 && y3 <= h)))
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- int x4 = int.Parse(Console.ReadLine());
- int y4 = int.Parse(Console.ReadLine());
- if (((x4 >= h && x4 <= 2 * h) && (y4 >= h && y4 <= 4 * h)) ||
- ((x4 >= 0 && x4 <= 3 * h) && (y4 >= 0 && y4 <= h)))
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- int x5 = int.Parse(Console.ReadLine());
- int y5 = int.Parse(Console.ReadLine());
- if (((x5 >= h && x5 <= 2 * h) && (y5 >= h && y5 <= 4 * h)) ||
- ((x5 >= 0 && x5 <= 3 * h) && (y5 >= 0 && y5 <= h)))
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- */
- }
- FIT IN BOX 28 APRIL ////////////////////////////////////////////////////////////////////////////////
- int w1 = int.Parse(Console.ReadLine());
- int h1 = int.Parse(Console.ReadLine());
- int d1 = int.Parse(Console.ReadLine());
- int w2 = int.Parse(Console.ReadLine());
- int h2 = int.Parse(Console.ReadLine());
- int d2 = int.Parse(Console.ReadLine());
- if (w1 < w2 && h1 < h2 && d1 < d2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, w2, h2, d2);
- }
- if (w1 < w2 && h1 < d2 && d1 < h2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, w2, d2, h2);
- }
- if (w1 < h2 && h1 < w2 && w1 < d2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, h2, w2, d2);
- }
- if (w1 < h2 && h1 < d2 && d1 < w2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, h2, d2, w2);
- }
- if (w1 < d2 && h1 < w2 && d1 < h2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, d2, w2, h2);
- }
- if (w1 < d2 && h1 < h2 && d1 < w2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w1, h1, d1, d2, h2, w2);
- }
- // vtora kutiq vurtene /////////////////////////////////////////////////////////////////
- if (w1 > w2 && h1 > h2 && d1 > d2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, w1, h1, d1);
- }
- if (w1 > w2 && h1 > d2 && d1 > h2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, w1, d1, h1);
- }
- if (w1 > h2 && h1 > w2 && d1 > d2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, h1, w1, d1);
- }
- if (w1 > h2 && h1 > d2 && d1 > w2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, h1, d1, w1);
- }
- if (w1 > d2 && h1 > w2 && d1 > h2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, d1, w1, h1);
- }
- if (w1 > d2 && h1 > h2 && d1 > w2)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})", w2, h2, d2, d1, h1, w1);
- }
- FIT IN BOX 2ri variant za reshenie avtorsko reshenie ////////////////////////////////////////////////////////////
- ///s metod
- int w1 = int.Parse(Console.ReadLine());
- int h1 = int.Parse(Console.ReadLine());
- int d1 = int.Parse(Console.ReadLine());
- int w2 = int.Parse(Console.ReadLine());
- int h2 = int.Parse(Console.ReadLine());
- int d2 = int.Parse(Console.ReadLine());
- // Try to fit the first box inside the second box (6 possibilities)
- CheckBoxes(w1, h1, d1, w2, h2, d2);
- CheckBoxes(w1, h1, d1, w2, d2, h2);
- CheckBoxes(w1, h1, d1, h2, w2, d2);
- CheckBoxes(w1, h1, d1, h2, d2, w2);
- CheckBoxes(w1, h1, d1, d2, w2, h2);
- CheckBoxes(w1, h1, d1, d2, h2, w2);
- // Try to fit the second box inside the first box (6 possibilities)
- CheckBoxes(w2, h2, d2, w1, h1, d1);
- CheckBoxes(w2, h2, d2, w1, d1, h1);
- CheckBoxes(w2, h2, d2, h1, w1, d1);
- CheckBoxes(w2, h2, d2, h1, d1, w1);
- CheckBoxes(w2, h2, d2, d1, w1, h1);
- CheckBoxes(w2, h2, d2, d1, h1, w1);
- }
- private static void CheckBoxes(
- int firstWidth, int firstHeight, int firstDepth,
- int secondWidth, int secondHeight, int secondDepth)
- {
- if (firstWidth < secondWidth && firstHeight < secondHeight && firstDepth < secondDepth)
- {
- Console.WriteLine("({0}, {1}, {2}) < ({3}, {4}, {5})",
- firstWidth, firstHeight, firstDepth, secondWidth, secondHeight, secondDepth);
- }
- 25 july morning ///////////////////////////////////// //////////////
- int startDayOfWeek = int.Parse(Console.ReadLine());
- int daysEating = int.Parse(Console.ReadLine());
- int melons = 0;
- int watermelons = 0;
- for (int i = startDayOfWeek; i < daysEating + startDayOfWeek; i++)
- {
- int dayOfWeek = i % 7;// delim i % 7 naprimer 3 % 7= 3 za da vleze v 3 den
- // 7 % 7 = 0
- // i sushto mi pravi Case ot 0 do 6 i ne moje ako sloja
- //(naprimer case 9 ne mi go za4ita zaduljitelno case ot 0 do 6)
- //i zatova v primera 5 den ot sedmicata i 6 dena qdene
- //mi vurti i 0 koqto v primera ne e izpisana
- switch (dayOfWeek)
- {
- ///* case 0:
- watermelons += 6;
- melons += 2;
- break; *///
- case 1:
- watermelons += 1;
- break;
- case 2:
- melons += 2;
- break;
- case 3:
- watermelons += 1;
- melons += 1;
- break;
- case 4:
- watermelons += 2;
- break;
- case 5:
- melons += 2;
- watermelons += 2;
- break;
- case 6:
- watermelons += 1;
- melons += 2;
- break;
- default:
- break;
- }
- }
- // moje i bez promenlivata diff a prosoto da si gi zapishem v if elsa
- // zaduljitelno go pravq polojitelno s Math.Abs//
- int diff = Math.Abs(melons - watermelons);
- if (melons > watermelons)
- {
- //moje bez diff a samo stoinosta na melons
- Console.WriteLine("{0} more melons", diff);
- }
- else if (watermelons > melons)
- {
- // moje bez diff a samo sotista na watermelons
- Console.WriteLine("{0} more watermelons ", diff);
- }
- else
- {
- Console.WriteLine("Equal amount: {0}", melons);
- 25 july evening Electricity /////////////////////////////////////////////////////////////////////
- //input
- int numberOfFloors = int.Parse(Console.ReadLine());
- int flatsPerFloor = int.Parse(Console.ReadLine());
- DateTime time = DateTime.Parse(Console.ReadLine());
- // stoinosti za reingja/range na time
- DateTime firstStart = DateTime.Parse("00:00");
- DateTime firstEnd = DateTime.Parse("08:59");
- DateTime secondStart = DateTime.Parse("14:00");
- DateTime secondEnd = DateTime.Parse("18:59");
- DateTime thirdStart = DateTime.Parse("19:00");
- DateTime thirdEnd = DateTime.Parse("23:59");
- double lampPower = 100.53;
- double compPower = 125.90;
- double totalPower = 0;
- // if za raztoqnieto ot vreme dali suvpada
- if (firstStart <= time && time <= firstEnd)
- {
- totalPower = totalPower + ((lampPower * 1) + (compPower * 8));
- }
- else if (secondStart <= time && time <= secondEnd)
- {
- totalPower = totalPower + ((lampPower * 2) + (compPower * 2));
- }
- else if (thirdStart <= time && time <= thirdEnd)
- {
- totalPower = totalPower + ((lampPower * 7) + (compPower * 6));
- }
- totalPower = totalPower *(numberOfFloors * flatsPerFloor);
- /// output
- Console.WriteLine("{0} Watts", (int)(totalPower));
- /////////////////////////////////////////////vtoro reshenie avtorsko /*
- int floors = int.Parse(Console.ReadLine());
- int flats = int.Parse(Console.ReadLine());
- DateTime time = DateTime.Parse(Console.ReadLine());
- int sumWats;
- if (time.Hour >= 14 && time.Hour <= 18)
- {
- // Noon time
- double noonConsumption = (2 * 100.53) + (2 * 125.90);
- sumWats = (int)(noonConsumption * flats * floors);
- }
- else if (time.Hour >= 19 && time.Hour <= 23)
- {
- // Afternoon time
- double afternoonConsumption = (7 * 100.53) + (6 * 125.90);
- sumWats = (int)(afternoonConsumption * flats * floors);
- }
- else if (time.Hour >= 0 && time.Hour <= 8)
- {
- // Midnight time
- double midnightConsumption = (1 * 100.53) + (8 * 125.90);
- sumWats = (int)(midnightConsumption * flats * floors);
- } */
- Console.WriteLine(sumWats + " Watts");
- 22 avgust TABLES//////////////////////////////////////////////////////////////////////////
- long budle1 = long.Parse(Console.ReadLine());
- long budle2 = long.Parse(Console.ReadLine());
- long budle3 = long.Parse(Console.ReadLine());
- long budle4 = long.Parse(Console.ReadLine());
- long tableTops = long.Parse(Console.ReadLine
- long tablesToBeMade = long.Parse(Console.ReadLine());
- long allLegs = (budle1 * 1) + (budle2 * 2) + (budle3 * 3) + (budle4 * 4);
- long tablesPossible = Math.Min(allLegs / 4 , tableTops);
- if (tablesPossible == tablesToBeMade)
- {
- Console.WriteLine("Just enough tables made: {0}", tablesToBeMade);
- }
- else if (tablesPossible > tablesToBeMade)
- {
- Console.WriteLine("more: {0} ",
- tablesPossible - tablesToBeMade < 0 ? 0 : tablesPossible - tablesToBeMade);
- ///////Math.Max(0,tablesPossible - tablesToBeMade));
- Console.WriteLine("tops left: {0}, legs left: {1}",
- Math.Max(0,tablesPossible - tablesToBeMade),
- Math.Max(0,allLegs - tablesToBeMade*4) );
- // ili legs - n*4 zashtoto vinagi shte e polojitelno 4islo
- }
- //******************************************************************
- else /////////moje I -> if (tablesToBeMade > tablesPossible)
- {
- Console.WriteLine("less: {0} ",
- tablesPossible - tablesToBeMade > 0 ? 0 : tablesPossible - tablesToBeMade);
- // ili da go izpisva taka edno i sushto e Console.WriteLine("less: {0} ",Math.Min(0, tablesPossible - tablesToBeMade));
- // poneje e 0 ili otricatelno nqma kak da imamme less polojitelni + masi
- //*******************************************
- Console.WriteLine("tops needed: {0}, legs needed: {1}",
- Math.Max(0, tablesToBeMade - tablesPossible),
- Math.Max(0, tablesToBeMade * 4 - allLegs));
- // legs needed mi trqbva vinagi 0 ili polojitelno chislo i kogato legs sa mi minus nqma kak da izpisha -2 lega
- // N * 4 - legs < 0 ? 0 : N * 4 - legs
- // ternaren operator koito ako e otricatelno da mi izpisva 0
- //poneje legs sa mi pove4e ot kolkoto imam nujda i nqmam needed -2
- //i ako e polojitelno da mi izpisva razlikata poneje need mi e pove4e
- }
- }
- ////Math.Min zima po-malkoto ot 2 4isla ako e
- //Math.Min(0, tablesPossible - tablesToBeMade)
- // vrushta 0 ili otricatelno chislo
- // Math.Max vrushta po-golqmata ot 2 sotinosti
- // ako e Math.Max(0, tablesToBeMade * 4 - allLegs));
- // za da mi vrushta 0 ili polojitelno chislo
- ////TABLES MOE VTORO RESHENIE bez Matn>min I Math.MAX ////////////////////////
- long budle1 = long.Parse(Console.ReadLine());
- long budle2 = long.Parse(Console.ReadLine());
- long budle3 = long.Parse(Console.ReadLine());
- long budle4 = long.Parse(Console.ReadLine());
- long T = long.Parse(Console.ReadLine());
- long N = long.Parse(Console.ReadLine());
- long legs = (budle1 * 1) + (budle2 * 2) + (budle3 * 3) + (budle4 * 4);
- long legsLeft = legs - (T * 4);
- long legsPosaibleTables = legs / 4;
- long posibleTables = Math.Abs(legsPosaibleTables - T);
- if (legsPosaibleTables > T)
- {
- posibleTables = legsPosaibleTables - posibleTables;
- }
- else if (T > legsPosaibleTables)
- {
- posibleTables = T - posibleTables;
- }
- else
- {
- posibleTables = T;
- }
- long tablesNeed = posibleTables - N;
- long legsneed = legs- N *4;
- long topsneed = T - N;
- if (tablesNeed == 0)
- {
- Console.WriteLine("Just enough tables made: {0}", N);
- }
- else if (posibleTables > N)
- {
- Console.WriteLine("more: {0} ", Math.Abs(tablesNeed));
- Console.WriteLine("tops left: {0}, legs left: {1}", topsneed, Math.Abs(legsneed));// ili legs - n*4 zashtoto vinagi trqbva da e polojitelno 4islo
- }
- else // if (need > posibleTables)
- {
- Console.WriteLine("less: {0} ", tablesNeed);
- Console.WriteLine("tops needed: {0}, legs needed: {1}", Math.Abs(topsneed), N * 4 - legs < 0 ? 0 : N * 4 - legs);
- // ternaren operator koito ako e otricatelno da mi izpisva 0
- //poneje legs sa mi pove4e ot kolkoto imam nujda i nqmam needed -2
- //i ako e polojitelno da mi izpisva razlikata poneje need mi e pove4e
- }
- 26 avgust TIC TAE TOE ////////////////////////////////////////////////////////////////////////////
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int value = int.Parse(Console.ReadLine());
- int position = 0;
- if(y==0 && x==0)
- {
- position = 1;
- }
- if (y == 0 && x == 1)
- {
- position = 2;
- }
- if (y == 0 && x == 2)
- {
- position = 3;
- }
- if (y == 1 && x == 0)
- {
- position = 4;
- }
- if (y == 1 && x == 1)
- {
- position = 5;
- }
- if (y == 1 && x == 2)
- {
- position = 6;
- }
- if (y == 2 && x == 0)
- {
- position = 7;
- }
- if (y == 2 && x == 1)
- {
- position = 8;
- }
- if (y == 2 && x == 2)
- {
- position = 9;
- }
- value = (value + position) - 1;
- // -1 zashtoto indeksa mi nadvishava stoinostta s 1
- // poneje 4isloto ot koeto trugvame e 10 position mi e 5 stava 15 ana men mi trqbva chisloto pod tazi pozicia koeto e 14 zatova vadim -1 i value mi stava 14
- Console.WriteLine((long)Math.Pow(value,position));// value po stepenta 14 na 5 stepen s math.pow
- // Math.Pow stoinosta i stepen koeto v primera e 14 na 5 stepen
- }
- 7 Noemvri BUDGET //////////////////////////////////////////////////////////////////////////
- long money = long.Parse(Console.ReadLine());
- long weekdaysGoingOut = long.Parse(Console.ReadLine());
- long hometownWeekends = long.Parse(Console.ReadLine());
- long normalWeekdays = 22 - weekdaysGoingOut;
- long totalWeekendsDays = 8;
- totalWeekendsDays -= (hometownWeekends * 2);
- // 10 * ((3% of 800) + 10)
- long moneySpent = normalWeekdays * 10;
- moneySpent += weekdaysGoingOut * ((((long)3 * money) / 100) + 10);
- moneySpent += 150;
- moneySpent += totalWeekendsDays * 20;
- long moneyLeft = money - moneySpent;
- if (moneyLeft > 0)
- {
- Console.WriteLine("Yes, leftover {0}.", moneyLeft);
- }
- else if (moneyLeft < 0)
- {
- Console.WriteLine("No, not enough {0}.", Math.Abs(moneyLeft));
- }
- else
- {
- Console.WriteLine("Exact Budget.");
- }
- 8 noemvri BABA TINCHE AIRLINES //////////////////////////////////////////////////////////////////
- // nachi za 4etene na nqkolko stoinosti ot edin red ReadLine
- string[] firstClassInfo = Console.ReadLine().Split();
- int firstClassPassengers = int.Parse(firstClassInfo[0]);
- int firstClassFrequent = int.Parse(firstClassInfo[1]);
- int firstClassMeals = int.Parse(firstClassInfo[2]);
- string[] secondClassInfo = Console.ReadLine().Split();
- int secondClassPassengers = int.Parse(secondClassInfo[0]);
- int secondClassFrequent = int.Parse(secondClassInfo[1]);
- int secondClassMeals = int.Parse(secondClassInfo[2]);
- string[] thirdClassInfo = Console.ReadLine().Split();
- int thirdClassPassengers = int.Parse(thirdClassInfo[0]);
- int thirdClassFrequent = int.Parse(thirdClassInfo[1]);
- int thirdClassMeals = int.Parse(thirdClassInfo[2]);
- int maxIncome = 233160;// maksimalnata pe4alba na baba tinche
- decimal income = 0m;
- income += (firstClassPassengers - firstClassFrequent) * 7000;
- income += firstClassFrequent * 7000 * 0.3m;
- income += firstClassMeals * 7000 * 0.005m;
- income += (secondClassPassengers - secondClassFrequent) * 3500;
- income += secondClassFrequent * 3500 * 0.3m;
- income += secondClassMeals * 3500 * 0.005m;
- income += (thirdClassPassengers - thirdClassFrequent) * 1000;
- income += thirdClassFrequent * 1000 * 0.3m;
- income += thirdClassMeals * 1000 * 0.005m;
- //income = (int)income;// preobrazuvame cqlta stoinost v int a ne samo
- // ot 1 red ili 2 na Console.WriteLine
- Console.WriteLine((int)(income));
- Console.WriteLine(maxIncome - (int)income);
- }
- 19 dekemvri TravelerBOB//////////////////////////////////////////////////////////
- //Reading input from the Console
- string year = Console.ReadLine();
- int contract = int.Parse(Console.ReadLine());
- int family = int.Parse(Console.ReadLine());
- //Calculating total travels for each type of month
- int contractTravels = contract * (4 * 3);
- int familyTravels = (2 * 2) * family;
- // double normalTravels = (((12 - contract - family) * 12) * 3 / 5.0);
- double normalTravels = 12 - contract - family;
- normalTravels = normalTravels * 12;
- normalTravels = normalTravels * 3 / 5.0;
- double totalTravels = contractTravels + familyTravels + normalTravels;
- //If the year is leap, 5% in addition
- if (year == "leap")
- {
- //totalTravels = totalTravels * 1.05;
- double procent = totalTravels * 5 / 100;
- totalTravels = totalTravels + procent;
- }
- //Printing the result
- Console.WriteLine((int)totalTravels);
- 20 dekemvri TANK ////////////////////////////////////////////////////////////////////////
- int price = int.Parse(Console.ReadLine());
- int partyDays = int.Parse(Console.ReadLine());
- int normalDays = 30 - partyDays;
- int monthlySavings = normalDays * 2;
- int monthlyExpenses = partyDays * 5;
- int monthlyBalance = monthlySavings - monthlyExpenses;
- double totalMonthsRequired = (double)price / monthlyBalance;
- /* int result = (int)Math.Ceiling(totalMonthsRequired);
- int years = result / 12;
- int months = result % 12; */
- // Math.Ceiling zakruglq do po-gornoto 4islo primer 2.1 go zakruglq na 3
- // i zashto delim result % 12 nz
- // mesecite zakruglqm na gore ot 410.2307 na 411
- // za da moje kato gi razdelim 411 % 12 da mi izkara 3 ne 2 kakto pri 410
- double result = Math.Ceiling(totalMonthsRequired);
- int intResulr = (int)(result);
- int years = intResulr / 12;
- int months = intResulr % 12;
- if (monthlyExpenses > monthlySavings )
- {
- Console.WriteLine("never");
- }
- else
- {
- Console.WriteLine("{0} years, {1} months", years, months);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement