제출 #133692

#제출 시각아이디문제언어결과실행 시간메모리
133692antimirage친구 (IOI14_friend)C++14
컴파일 에러
0 ms0 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int c[],int p[],int t[]){ int ans = 0; for (int i = n - 1'; i >= 0; i--) { if (t[i] == 0) { c[p[i]] = max(0, c[p[i]] - c[i]); ans += c[i]; } else if (t[i] == 1) { c[p[i]] += c[i]; } else { c[p[i]] = max( c[p[i]], c[i] ); } } return ans + c[0]; }

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

friend.cpp:9:20: warning: missing terminating ' character
  for (int i = n - 1'; i >= 0; i--) {
                    ^
friend.cpp:9:20: error: missing terminating ' character
  for (int i = n - 1'; i >= 0; i--) {
                    ^~~~~~~~~~~~~~~~~
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:10:3: error: expected ';' before 'if'
   if (t[i] == 0) {
   ^~
friend.cpp:10:3: error: expected primary-expression before 'if'
friend.cpp:10:3: error: expected ';' before 'if'
friend.cpp:10:3: error: expected primary-expression before 'if'
friend.cpp:10:3: error: expected ')' before 'if'
friend.cpp:18:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^
friend.cpp: At global scope:
friend.cpp:19:2: error: expected unqualified-id before 'return'
  return ans + c[0];
  ^~~~~~
friend.cpp:20:1: error: expected declaration before '}' token
 }
 ^