제출 #61723

#제출 시각아이디문제언어결과실행 시간메모리
61723nvmdava선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" long long delivery(int N, int K, int L, int p[]) { long long ans = (long long)(N + K - 1) / K * L int i; while(p[i] == 0)i++; i += K - 1; while(i < n && p[i] * 2 < L){ ans = ans - L + p[i] * 2 i+=k; } i = n - k; while(i >= 0 && (L -p[i]) * 2 < L){ ans = ans - L + (L - p[i]) * 2; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:6:2: error: expected ',' or ';' before 'int'
  int i;
  ^~~
boxes.cpp:7:10: error: 'i' was not declared in this scope
  while(p[i] == 0)i++;
          ^
boxes.cpp:8:2: error: 'i' was not declared in this scope
  i += K - 1;
  ^
boxes.cpp:9:12: error: 'n' was not declared in this scope
  while(i < n && p[i] * 2 < L){
            ^
boxes.cpp:13:6: error: 'n' was not declared in this scope
  i = n - k;
      ^
boxes.cpp:13:10: error: 'k' was not declared in this scope
  i = n - k;
          ^