private static int compareRatings(ratings a, ratings b) { int score = 0; if (a.clarity > b.clarity) { score++; } if (a.difficulty > b.difficulty) { score++; } if (a.originality > b.originality) { score++; } return(score); }
//https://www.hackerrank.com/challenges/compare-the-triplets static void Main(string[] args) { string[] firstLine = Console.ReadLine().Split(' '); ratings A = new ratings( Convert.ToInt32(firstLine[0]), Convert.ToInt32(firstLine[1]), Convert.ToInt32(firstLine[2])); string[] secondLine = Console.ReadLine().Split(' '); ratings B = new ratings( Convert.ToInt32(secondLine[0]), Convert.ToInt32(secondLine[1]), Convert.ToInt32(secondLine[2])); int scoreOfA = compareRatings(A, B); int scoreOfB = compareRatings(B, A); Console.WriteLine(scoreOfA.ToString() + " " + scoreOfB.ToString()); Console.ReadLine(); }