Advertisement
sivancheva

02-Encoded Answers

May 26th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02_Encoded_Answers
  8. {
  9. class EncodedAnswers
  10. {
  11. static void Main(string[] args)
  12. {
  13. int N = int.Parse(Console.ReadLine());
  14.  
  15. int counterA = 0;
  16. int counterB = 0;
  17. int counterC = 0;
  18. int counterD = 0;
  19. string result = null;
  20.  
  21. for (int i = 0; i < N; i++)
  22.  
  23. {
  24. string answer;
  25. uint num = uint.Parse(Console.ReadLine());
  26.  
  27.  
  28. if (num % 4 == 0)
  29. {
  30. counterA++;
  31. answer = "a";
  32.  
  33. }
  34. else if (num % 4 == 1 )
  35. {
  36. counterB++;
  37. answer = "b";
  38. }
  39. else if (num % 4 == 2)
  40. {
  41. counterC++;
  42. answer = "c";
  43. }
  44. else if (num % 4 == 3)
  45. {
  46. counterD++;
  47. answer = "d";
  48. }
  49.  
  50. result += answer + ' ';
  51.  
  52. }
  53. Console.WriteLine(result);
  54. Console.WriteLine("Answer A: {0}", counterA);
  55. Console.WriteLine("Answer B: {0}", counterB);
  56. Console.WriteLine("Answer C: {0}", counterC);
  57. Console.WriteLine("Answer D: {0}", counterD);
  58.  
  59. }
  60. }
  61. }
  62. // https://judge.softuni.bg/Contests/Practice/Index/163#1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement