Advertisement
velislavnikolov

Tic-Tac-Toe Power

Oct 19th, 2014
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. using System;
  2.  
  3. class TicTacToe
  4. {
  5. static void Main()
  6. {
  7. long x = int.Parse(Console.ReadLine());
  8. int y = int.Parse(Console.ReadLine());
  9. int firstValue = int.Parse(Console.ReadLine());
  10. int c;
  11. int index;
  12.  
  13. int value1 = firstValue;
  14. int value2 = firstValue + 1;
  15. int value3 = firstValue + 2;
  16. int value4 = firstValue + 3;
  17. int value5 = firstValue + 4;
  18. int value6 = firstValue + 5;
  19. int value7 = firstValue + 6;
  20. int value8 = firstValue + 7;
  21. int value9 = firstValue + 8;
  22.  
  23. if (x == 0 && y == 0)
  24. {
  25. c = value1;
  26. index = 1;
  27. }
  28. else if (x == 0 && y == 1)
  29. {
  30. c = value2;
  31. index = 2;
  32. }
  33. else if (x == 0 && y == 2)
  34. {
  35. c = value3;
  36. index = 3;
  37. }
  38. else if (x == 1 && y == 0)
  39. {
  40. c = value4;
  41. index = 4;
  42. }
  43. else if (x == 1 && y == 1)
  44. {
  45. c = value5;
  46. index = 5;
  47. }
  48. else if (x == 1 && y == 2)
  49. {
  50. c = value6;
  51. index = 6;
  52. }
  53. else if (x == 2 && y == 0)
  54. {
  55. c = value7;
  56. index = 7;
  57. }
  58. else if (x == 2 && y == 1)
  59. {
  60. c = value8;
  61. index = 8;
  62. }
  63. else
  64. {
  65. c = value9;
  66. index = 9;
  67. }
  68. Console.WriteLine(Math.Pow(c, index));
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement