Advertisement
ramsess

2 зад

Feb 18th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Lecture
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main (string[] args)
  8.         {
  9.             int Size = int.Parse(Console.ReadLine ());
  10.             string Text = Console.ReadLine ();
  11.  
  12.             int WhiteSum = 0;
  13.             int BlackSum = 0;
  14.             Size = Size * Size;
  15.  
  16.  
  17.             for (int i = 0; i < Size; i++) {
  18.                 if (Text.Length != i) {
  19.                     if (i % 2 == 0) {
  20.                         WhiteSum = WhiteSum + Text [i];
  21.                     } else {
  22.                         BlackSum = BlackSum + Text [i];
  23.                     }
  24.                 }
  25.             }
  26.  
  27.             Console.WriteLine ("{0} white",WhiteSum);
  28.             Console.WriteLine ("{0} Black",BlackSum);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement