제출 #874056

#제출 시각아이디문제언어결과실행 시간메모리
874056WongYiKai친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]){ int n,temp,temp2,test = 0,high = 0; for (int i=0;i<n;i++){ temp = confidence[i]; high = max(high,temp); } for (int i=1;i<n;i++){ if (protocol[i] != 2) test = 1; } if (test == 0){ return high; } }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:5:8: error: declaration of 'int n' shadows a parameter
    5 |    int n,temp,temp2,test = 0,high = 0;
      |        ^
friend.cpp:4:20: note: 'int n' previously declared here
    4 | int findSample(int n, int confidence[], int host[], int protocol[]){
      |                ~~~~^
friend.cpp:5:15: warning: unused variable 'temp2' [-Wunused-variable]
    5 |    int n,temp,temp2,test = 0,high = 0;
      |               ^~~~~
friend.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^