Programming basic exam task 2
Здравейте ,
преди известно време се бях пробвал във Programming Basic и ми остана малко да го взема,не бях достатъно подготвен.
Та в момента се упражнявам отново и имам проблем с една задача и много ще съм благодарен ако някой ми даде съвет защо не минавам judge-a.
Това ми е заданието:
Write a program to calculate points for all players and find who the winner is. You will be given the count of the players, their names and initial scores. Score for every player depends on his name. To the player score add or subtract the ASCII code of each letter. If ASCII code is even add it to the score. If is odd – subtract it from the score. Find the one with highest score and print his name and score on the console. If two or more players are with same points – the winner is the first one.
Input
On the first input line you will be given number N - the count of players.
On the next 2*N lines you will be given player name and hi initial score.
Output
The output should be printed on the console and consist the name of the winner and his score in the following format:
“The winner is {name} - {points} points”
Constraints
- N – the count of players will be a positive integer in the range [1...100]
- Names will be strings with length between 3 and 30
- The score for each player will be a integer in the range [-100,000...100,000]
Examples
Input |
Output |
Comments |
||||||
3 Bojidar 123 Preslav 123 Pesho 123 |
The winner is Preslav - 230 points |
B(66)o(111)j(106)i(105)d(100)a(97)r(114) Initial points 123 scores 123 +66 -111 +106 -105 +100 -97 +114 = 196
P(80)r(114)e(101)s(115)l(108)a(97)v(118) Initial points 123 scores 123 +80 +114 -101 -115 +108 -97 +118 = 230
P(80)e(101)s(115)h(104)o(111) Initial points 123 scores 123 +80 -101 -115 +104 -111 = -20
Preslav(230) > Bojidar(196) > Pesho(-20) Write a program to calculate points for all players and find who the winner is. You will be given the count of the players, their names and initial scores. Score for every player depends on his name. To the player score add or subtract the ASCII code of each letter. If ASCII code is even add it to the score. If is odd – subtract it from the score. Find the one with highest score and print his name and score on the console. If two or more players are with same points – the winner is the first one. InputOn the first input line you will be given number N - the count of players. On the next 2*N lines you will be given player name and hi initial score. OutputThe output should be printed on the console and consist the name of the winner and his score in the following format: “The winner is {name} - {points} points” Constraints
Examples
|
ето и года ми :
http://pastebin.com/FkCgeXmB
вече блокирах.може ли да пуснеш код?
Здравей,
string name = string.Empty;
int maxScore;
for 0 to playersCount
string currentName =
int initialScore =
int currentScore = ...
if (currentScore > maxScore)
maxScore = currentScore;
name = currentName
Не ти правя голяма услуга като ти пиша кода. Опитай следващия път да го измислиш сам.
Поздрави!
мерси бро,направих я снощи с два масива.