grach

2016_November_20M Battles

Feb 11th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 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 Battles
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int m = int.Parse(Console.ReadLine());
  15.             int maxBattle = int.Parse(Console.ReadLine());
  16.  
  17.             var battleCount = 0;
  18.  
  19.             for (int i = 1; i <= n; i++)
  20.             {
  21.                 for (int j = 1; j <= m; j++)
  22.                 {
  23.                     battleCount++;
  24.                     if (battleCount > maxBattle)
  25.                     {
  26.                         break;
  27.                     }
  28.                     Console.Write("({0} <-> {1}) ", i, j);
  29.  
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Add Comment
Please, Sign In to add comment