当前位置:网站首页>[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;
}
边栏推荐
- How to download GB files from Google cloud hard disk
- [email protected]树莓派
- HAC cluster modifying administrator user password
- How to get list length
- Unity Vector3. Use and calculation principle of reflect
- Notes, continuation, escape and other symbols
- [detailed explanation of Huawei machine test] statistics of shooting competition results
- Steady, 35K, byte business data analysis post
- 初识CDN
- 巨杉数据库再次亮相金交会,共建数字经济新时代
猜你喜欢
Vulhub vulnerability recurrence 67_ Supervisor
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
Steady, 35K, byte business data analysis post
【torch】|torch.nn.utils.clip_grad_norm_
什么是独立IP,独立IP主机怎么样?
RustDesk 搭建一个自己的远程桌面中继服务器
Unity Vector3. Use and calculation principle of reflect
js Array 列表 实战使用总结
Redis message queue
[leetcode] 18. Sum of four numbers
随机推荐
UCF (summer team competition II)
27io stream, byte output stream, OutputStream writes data to file
How to use PHP string query function
【torch】|torch. nn. utils. clip_ grad_ norm_
In 2022, we must enter the big factory as soon as possible
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
【华为机试真题详解】检查是否存在满足条件的数字组合
Vulhub vulnerability recurrence 71_ Unomi
Algorithm -- climbing stairs (kotlin)
28io stream, byte output stream writes multiple bytes
Game push: image / table /cv/nlp, multi-threaded start!
C# AES对字符串进行加密
What impact will frequent job hopping have on your career?
【云原生】3.1 Kubernetes平台安装KubeSpher
[leetcode] 18. Sum of four numbers
2022 half year summary
【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
(column 22) typical column questions of C language: delete the specified letters in the string.
Pix2pix: image to image conversion using conditional countermeasure networks
Improve jpopup to realize dynamic control disable