Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MXML 1.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7.  
  8. namespace Olimp
  9. {
  10.     class Team
  11.     {
  12.         public Team(int power)
  13.         {
  14.             this.power = power;
  15.         }
  16.  
  17.         public Team()
  18.         {
  19.         }
  20.  
  21.         private int power;
  22.    
  23.         public int Powah {
  24.             get { return this.power; }
  25.             set { this.power = value; }
  26.         }
  27.     }
  28.  
  29.     class Program
  30.     {
  31.         static void Main(string[] args)
  32.         {
  33.             StreamReader reader = new StreamReader("info.txt");
  34.             List<Team> teams = new List<Team>();
  35.  
  36.             while(!reader.EndOfStream)
  37.                 teams.Add(new Team {
  38.                     Powah=int.Parse(reader.ReadLine())
  39.                 } );
  40.  
  41.  
  42.             for (int j = 0; j < length; j++)
  43.               for (int i = 0; i < teams.Count-1; i+=2)
  44.                    {
  45.                        if (teams[i].Powah < teams[i + 1].Powah)
  46.                        {
  47.                            Team temp = teams[i];
  48.                            teams[i] = teams[i + 1];
  49.                            teams[i + 1] = temp;
  50.                        }
  51.                    }
  52.            
  53.        
  54.            Console.ReadKey();
  55.          
  56.        }
  57.    }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement