답안 #874056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874056 2023-11-16T08:39:19 Z WongYiKai 친구 (IOI14_friend) C++17
컴파일 오류
0 ms 0 KB
#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;
    }
}
 

Compilation message

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 | }
      | ^