当前位置:网站首页>[Jiudu OJ 08] simple search x
[Jiudu OJ 08] simple search x
2022-07-06 05:37:00 【CodeLinghu】
【 Nine degrees OJ 08】 Easy to find x
One 、 The question
Two 、 The answer process
Ideas :
Is to enumerate violent solutions , It's not hard to
#include <iostream>
int main() {
int buf[200];
int n;
while(scanf("%d",&n)!=EOF)
{
for (int i = 0; i <n ; ++i)
{
scanf("%d",&buf[i]);
}
int x,ans=-1;
scanf("%d",&x);
for (int i = 0; i <n ; ++i)// Traverse the array elements in turn
{
if(buf[i]==x){
// The target number is compared with the array elements in turn
ans=i;
break;// Find the answer and jump out of the loop
}
}
printf("%d\n",ans);
}
return 0;
}
边栏推荐
- Vulhub vulnerability recurrence 72_ uWSGI
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 05. Security of blog project
- 指针经典笔试题
- Vulhub vulnerability recurrence 67_ Supervisor
- 指針經典筆試題
- ARTS Week 25
- Promotion hung up! The leader said it wasn't my poor skills
- Pointer classic written test questions
猜你喜欢
In 2022, we must enter the big factory as soon as possible
Safe mode on Windows
Easy to understand I2C protocol
Problems encountered in installing mysql8 on MAC
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
Application Security Series 37: log injection
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
Codeforces Round #804 (Div. 2) Editorial(A-B)
Codeforces Round #804 (Div. 2) Editorial(A-B)
05. 博客项目之安全
随机推荐
Codeforces Round #804 (Div. 2) Editorial(A-B)
注释、接续、转义等符号
28io stream, byte output stream writes multiple bytes
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
算法-- 爬楼梯(Kotlin)
(column 22) typical column questions of C language: delete the specified letters in the string.
Vulhub vulnerability recurrence 71_ Unomi
[untitled]
What impact will frequent job hopping have on your career?
Web Security (V) what is a session? Why do I need a session?
自建DNS服务器,客户端打开网页慢,解决办法
P2802 回家
Notes, continuation, escape and other symbols
Codeless June event 2022 codeless Explorer conference will be held soon; AI enhanced codeless tool launched
Web Security (VI) the use of session and the difference between session and cookie
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
Pickle and savez_ Compressed compressed volume comparison
05. 博客项目之安全
Selective parameters in MATLAB functions