35072023-02-28 14:21:58vááááTalálkozáscpp11Forditási hiba
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace találka
{
    class Program
    {
        static void Main(string[] args)
        {
            double n = Convert.ToDouble(Console.ReadLine());
            int[] be = new int[100001];
            int[] ki = new int[100001];
            string a;
            int bek;
            int kik;
            int max = 0;
            for (int i = 0; i < n; i++)
            {
                a = Console.ReadLine();
                bek = int.Parse(a.Split()[0]);
                kik = int.Parse(a.Split()[1]);
                if (be[bek] == 0) be[bek] = 1;
                else be[bek]++;
                if (ki[kik] == 0) ki[kik] = 1;
                else ki[kik]++;
                if (max < kik) max = kik + 1;
            }
            be[0] = 0;
            ki[0] = 0;
            int k = 0, v = 0, jk = 0, jv = 0, mint = int.MaxValue, bent = 0, benttemp = 0;
            bool volt = false;
            while(true)
            {
                if (v > max-1) break;
                v++;
                bent += be[v];
                int j = 2;
                while(bent >= n/2)
                {
                    volt = true;
                    k++;
                    benttemp = bent;
                    bent -= ki[k - 1];
                }
                if(volt)
                {
                    k--;
                    volt = false;
                    bent = benttemp;
                    if(mint > v - k)
                    {
                        jk = k;
                        jv = v;
                        mint = v - k;

                    }
                }
            }
            Console.WriteLine(mint+1);
            Console.WriteLine(jk + " " + jv);
            Console.ReadKey();
        }
    }
}
Forditási hiba
exit status 1
main.cpp:1:4: error: expected nested-name-specifier before 'System'
    1 | using System;
      |    ^~~~~~
main.cpp:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
main.cpp:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
main.cpp:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
main.cpp:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
main.cpp:11:26: error: 'string' has not been declared
   11 |         static void Main(string[] args)
      |                          ^~~~~~
main.cpp:11:35: error: expected ',' or '...' before 'args'
   11 |         static void Main(string[] args)
      |                                   ^~~~
main.cpp:66:6: error: expected ';' after class definition
   66 |     }
      |      ^
      |      ;
main.cpp: In static memb...