当前位置:网站首页>Pirate OJ 448 luck draw

Pirate OJ 448 luck draw

2022-06-11 00:43:00 Polaris_ GQ

 Please add a picture description
 Please add a picture description

The input and output part of this question Deal with... Separately ; Some questions can Input one time for processing , Finally, output uniformly ;

#include <iostream> 
using namespace std;
int main(){
    
	int n,num;
	// Input part  
	cin>>n;
	int N[n];
	for(int i=0;i<n;i++){
    
		cin>>N[i];	
	}
	cin>>num;
	// Output part :
	for(int i=0;i<n;i++){
    
		if(num==N[i]){
    
			cout<<i+1;
			return 0;
		}
	} 
	cout<<0;
	return 0;	
}

原网站

版权声明
本文为[Polaris_ GQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206102319225439.html