Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _10.Volleyball
- {
- class Volleyball
- {
- static void Main(string[] args)
- {
- //• Първият ред съдържа думата “leap” (високосна година) или “normal” (невисокосна).
- string years =Console.ReadLine().ToLower();
- //• Вторият ред съдържа цялото число p – брой празници в годината (които не са събота и неделя).
- int weekendsInYear = int.Parse(Console.ReadLine());
- //• Третият ред съдържа цялото число h – брой уикенди, в които Влади си пътува до родния град.
- int weekendCount = int.Parse(Console.ReadLine());
- double allAmountOfGames = 0;
- double weekendsGames = 0;
- double allWeekendsInYear = (48.0 - weekendCount) * (3.0 / 4.0);
- switch (years)
- {
- case "leap": weekendsGames = weekendsInYear * (2.0 / 3.0);
- weekendsGames += allWeekendsInYear + weekendCount;
- double weekendsleapGames = weekendsGames * 0.15;
- allAmountOfGames = Math.Floor(weekendsleapGames + weekendsGames);
- Console.WriteLine(allAmountOfGames);
- break;
- case "normal": weekendsGames = weekendsInYear * (2.0 / 3.0);
- weekendsGames += allWeekendsInYear + weekendCount;
- allAmountOfGames = Math.Floor(weekendsGames);
- Console.WriteLine(allAmountOfGames);
- break;
- default:
- break;
- }
- //Втори начин:
- //double allAmountOfGames = 0;
- //double weekendsGames = 0;
- //double allWeekendsInYear = (48.0 - weekendCount) * (3.0/4.0);
- //if (years=="leap")
- //{
- // weekendsGames = weekendsInYear * (2.0 / 3.0);
- // weekendsGames += allWeekendsInYear+ weekendCount;
- // double weekendsleapGames = weekendsGames * 0.15;
- // allAmountOfGames = Math.Floor(weekendsleapGames + weekendsGames);
- // Console.WriteLine(allAmountOfGames);
- //}
- //else
- //{
- // weekendsGames = weekendsInYear * (2.0 / 3.0);
- // weekendsGames += allWeekendsInYear + weekendCount;
- // allAmountOfGames = Math.Floor(weekendsGames);
- // Console.WriteLine(allAmountOfGames);
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment