ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1025. Democracy in Danger

Accepted C#
Posted by Адель 11 Nov 2020 13:46
using System;
using System.Linq;
namespace e3
{
    class Program
    {
        public static void Main(string[] args)
        {
            int k=int.Parse(Console.ReadLine());
            int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int temp;
            for (int i = 0; i < k - 1; i++) {
        for (int j = 0; j < k - i - 1; j++) {
            if (arr[j] > arr[j + 1]) {
                // меняем элементы местами
                temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }

            int s=0;
            for (int i = 0; i < k/2+1; i++) {
                s=s+(arr[i]/2+1);
            }
            Console.WriteLine(s);

        }
    }
}
Re: Accepted C#
Posted by Vitaly 28 Aug 2021 19:18


Edited by author 28.08.2021 19:25