제출 #234238

#제출 시각아이디문제언어결과실행 시간메모리
234238MickyAngel말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include "horses.h" #include <algorithm> using namespace std; int init(int N,int X[],int Y[]){ int V[N]; V[0] = X[0]; for (int i-1; i<N; i++) V[i] = V[i-1] * X[i]; int mx = 0; for(int i=0; i<N; i++) { mx = max (mx, V[i] Y[i]); } return mx; } int updateX(int pos, int val) { return 0; } int updateY(int pos, int val) { return 0; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:9:12: error: expected ';' before '-' token
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
            ^
horses.cpp:9:17: warning: for increment expression has no effect [-Wunused-value]
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
                ~^~
horses.cpp:9:19: error: expected ')' before ';' token
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
                   ^
horses.cpp:9:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
  ^~~
horses.cpp:9:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
                     ^
horses.cpp:9:21: error: 'i' was not declared in this scope
horses.cpp:12:11: warning: declaration of 'i' shadows a previous local [-Wshadow]
  for(int  i=0;  i<N;  i++)  { 
           ^
horses.cpp:9:21: note: shadowed declaration is here
  for (int i-1; i<N; i++) V[i] = V[i-1] * X[i];
                     ^
horses.cpp:13:28: error: expected ')' before 'Y'
    mx  =  max  (mx,  V[i]  Y[i]);
                            ^
horses.cpp:6:30: warning: unused parameter 'Y' [-Wunused-parameter]
 int init(int N,int X[],int Y[]){
                              ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:19:19: warning: unused parameter 'pos' [-Wunused-parameter]
 int  updateX(int  pos,  int  val)  { 
                   ^~~
horses.cpp:19:30: warning: unused parameter 'val' [-Wunused-parameter]
 int  updateX(int  pos,  int  val)  { 
                              ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:23:20: warning: unused parameter 'pos' [-Wunused-parameter]
  int  updateY(int  pos,  int  val)  {
                    ^~~
horses.cpp:23:31: warning: unused parameter 'val' [-Wunused-parameter]
  int  updateY(int  pos,  int  val)  {
                               ^~~