92532024-02-19 11:45:38Leventusz09Utazásszervezés (75 pont)cpp17Forditási hiba
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utazásszervezés{
    class Program{
        static void Main(){
            int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = in1[0],  //idegenvezetők
                K = in1[1],  //szezon
                M = in1[2],  //utazások hossza
                C = in1[3];  //utazások
            int[] Ig = Console.ReadLine().Split().Select(int.Parse).ToArray();
            /* V1 int temp = N;
            int o1 = 0;
            int[] ret = new int[K];

            for (int i = 0, j; i < C; i++){
                if (i > 0) for (j = Ig[i - 1] - 1; j < Ig[i] - 1; j++) temp += ret[j];
                if (temp > 0){
                    o1++;
                    temp--;
                    if (Ig[i] - 1 + M < K) ret[Ig[i] - 1 + M]++;
                }
            }*/

            int o1 = 0;
            int[] b = new int[N];
            for(int i=0; i<C; i++){
                for(int j=0; j<N; j++) { 
                    if(b[j] < Ig[i]-1){
                        b[j] = i + M - 1;
                        o1++;
                        break;
                    }
                }
            }

            Console.WriteLine(o1);
        }
    }
}
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:43:6: error: expected ';' after class definition
   43 |     }
      |      ^
      |      ;
main.cpp: In static member function 'static void Utaz\U000000e1sszervez\U000000e9s::Program::Main()':
main.cpp:10:16: error: structured binding declaration cannot have type 'int'
   10 |             int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
      |                ^~
main.cpp:10:16: note: type ...