当前位置:网站首页>[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;
}
边栏推荐
- [SQL Server fast track] - authentication and establishment and management of user accounts
- Configuration file converted from Excel to Lua
- 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
- Summary of deep learning tuning tricks
- Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
- B站刘二大人-反向传播
- Figure database ongdb release v-1.0.3
- Promotion hung up! The leader said it wasn't my poor skills
- 指针经典笔试题
- 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
猜你喜欢

巨杉数据库再次亮相金交会,共建数字经济新时代
![[untitled]](/img/7e/d0724193f2f2c8681a68bda9e08289.jpg)
[untitled]

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

01. Project introduction of blog development project

B站刘二大人-数据集及数据加载 Lecture 8

SequoiaDB湖仓一体分布式数据库2022.6月刊

PDK工艺库安装-CSMC

02. Develop data storage of blog project

【OSPF 和 ISIS 在多路访问网络中对掩码的要求】

03. Login of development blog project
随机推荐
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
B站刘二大人-线性回归 Pytorch
How to download GB files from Google cloud hard disk
大型网站如何选择比较好的云主机服务商?
01. 开发博客项目之项目介绍
类和对象(一)this指针详解
Redis message queue
SQLite queries the maximum value and returns the whole row of data
Modbus protocol communication exception
Fluent implements a loadingbutton with loading animation
Algorithm -- climbing stairs (kotlin)
HAC集群修改管理员用户密码
How to use PHP string query function
【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
After the project is released, index Html is cached
jdbc使用call调用存储过程报错
Installation de la Bibliothèque de processus PDK - csmc
Problems encountered in installing mysql8 on MAC
Vulhub vulnerability recurrence 69_ Tiki Wiki