제출 #285555

#제출 시각아이디문제언어결과실행 시간메모리
2855552qbingxuan휴가 (IOI14_holiday)C++14
컴파일 에러
0 ms0 KiB
#include"holiday.h" long long int findMaxAttraction(int n, int start, int d, int attraction[]) { if(start == 0) { int cnt[101] = {}; for(int i = 0; i < n; i++) { ++cnt[attraction[i]]; if(d - i - 1 > 0) { int k = d - i - 1; int ans = 0; for(int j = 100; j >= 1; j--) { if(k > cnt[j]) k -= cnt[j], ans += cnt[j] * j; else ans += cnt[j] * k, k = 0; } cout << ans << '\n'; } } } }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:15:17: error: 'cout' was not declared in this scope
   15 |                 cout << ans << '\n';
      |                 ^~~~
holiday.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^