제출 #24610

#제출 시각아이디문제언어결과실행 시간메모리
24610jiangzhiKangaroo (CEOI16_kangaroo)C++11
컴파일 에러
0 ms0 KiB
#include <cstdio> const int N = 2010; int vec[N]; int main(){ freopen("kangaroo.in","r",stdin); freopen("kangoroo.out","w",stdout); int n,s,e; scanf("%d%d%d", &n,&s,&e); for(int i = 1; i <= n ;i++){ scanf("%d", &vec[i]); } int ans = 0; do{ if(s!=vec[0] || e != vec[n-1])continue; int ok = 1; for(int i = 0; i < n-2; i++){ if((vec[i] - vec[i+1] > 0) == (vec[i+1] - vec[i+2] >0))ok=0; } if(ok)ans=+; }while(next_permutation(vec,vec+n)); printf("%d\n",ans); }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:22:14: error: expected primary-expression before ';' token
   if(ok)ans=+;
              ^
kangaroo.cpp:24:35: error: 'next_permutation' was not declared in this scope
  }while(next_permutation(vec,vec+n));
                                   ^
kangaroo.cpp:8:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("kangaroo.in","r",stdin);
                                  ^
kangaroo.cpp:9:36: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("kangoroo.out","w",stdout);
                                    ^
kangaroo.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &n,&s,&e);
                           ^
kangaroo.cpp:13:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &vec[i]);
                       ^