C# - Exercises: Data Types and Variables - 11.SnowBalls - 90/100
Здравейте колефи,
Може ли малко помощ със следната задача:
Tony and Andi love playing in the snow and having snowball fights, but they always argue which makes the best snowballs. Because they are girls (which means they are completely illogical), they have decided to involve you in their fray, by making you write a program which calculates snowball data, and outputs the best snowball value.
You will receive N – an integer, the number of snowballs being made by Tony and Andi.
For each snowball you will receive 3 input lines:
- On the first line you will get the snowballSnow – an integer.
- On the second line you will get the snowballTime – an integer.
- On the third line you will get the snowballQuality – an integer.
For each snowball you must calculate its snowballValue by the following formula:
(snowballSnow / snowballTime) ^ snowballQuality
At the end you must print the highest calculated snowballValue.
Input
- On the first input line you will receive N – the number of snowballs.
- On the next N * 3 input lines you will be receiving data about snowballs.
Output
- As output you must print the highest calculated snowballValue, by the formula, specified above.
- The output format is:
{snowballSnow} : {snowballTime} = {snowballValue} ({snowballQuality})
Constraints
- The number of snowballs (N) will be an integer in range [0, 100].
- The snowballSnow is an integer in range [0, 1000].
- The snowballTime is an integer in range [1, 500].
- The snowballQuality is an integer in range [0, 100].
- Allowed working time / memory: 100ms / 16MB.
Examples
Input |
Output |
2 10 2 3 5 5 5 |
10 : 2 = 125 (3) |
3 10 5 7 16 4 2 20 2 2 |
10 : 5 = 128 (7) |
Ето и моя код: https://pastebin.com/6bdH35sx
Judge дава 90/100 и не мога да си намеря грашката.Всички проверки излизат.
@Dani77
Mersi Dani, i az imah 90/100 no kato izpolzvah tvoqta logika za BigInteger mi dade 100/100.
Zashto mislish BigInteger raboti a kogato raboteh s double mi davashe greshka. Eto i dvata koda za sravnenie:
100/100 https://pastebin.com/UtRnTeKX
90/100 https://pastebin.com/Z4LmyHhS
Да, вкарах BigInteger в задачата и илзезе 100/100.Използвах го също вместо Math.Pow / BigInteger.Pow
https://www.dotnetperls.com/biginteger
Ето повече информация за BigInteger . Това ще ти даде отговор на въпроса.
Извинявайте за глупавият въпрос но защо при мен във VisualStudio 2019 BigInteger не работи. Пробвах да го направя и с .NET Framework и с .NET Core и не успявам да дифинирам BigInteger.
Малко избързах не видях:
"using System.Numerics;"