首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
找x
[编程题]找x
热度指数:24845
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
算法知识视频讲解
输入一个数n,然后输入n个数值各不相同,再输入一个值x,输出这个值在这个数组中的下标(从0开始,若不在数组中则输出-1)。
输入描述:
测试数据有多组,输入n(1<=n<=200),接着输入n个数,然后输入x。
输出描述:
对于每组输入,请输出结果。
示例1
输入
2 1 3 0
输出
-1
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(64)
分享
提交结果有问题?
103个回答
57篇题解
开通博客
牛烘烘
发表于 2022-03-24 17:37:14
#include<iostream> #include<cstdio> using namespace std; int maxn=200+10; int main(){ int arr[maxn]; int n; while(scanf("%d",&
展开全文
MrMello
发表于 2023-03-16 15:57:43
#include <stdio.h> int main(){ int num; scanf("%d", &num); int arr[num]; for (int i = 0; i < num; ++i) { scanf("%d",
展开全文
哆啦A梦的百宝袋1234
发表于 2024-01-15 10:29:36
#include <bits/stdc++.h> using namespace std; int main(){ int n,x,f; while(cin>>n){ map<int,int> mp;//输入的数各不相同,故可用映射 for(int i
展开全文
牛客440904392号
发表于 2024-09-30 22:18:38
n = input() nums = input().split() target = input() for i in range(len(nums)): if target == nums[i]: print(i) break else: prin
展开全文
猪宅山里针不戳
发表于 2025-02-26 09:00:54
#include <stdio.h> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<int> vec(n);
展开全文
小徐小徐啊啊
发表于 2024-03-10 20:29:17
#include <stdio.h> int main() { int n; while(scanf("%d",&n)!=EOF) { int a[n]; for(int i=0;i<n;i++) { scanf
展开全文
coder_bai
发表于 2023-01-03 11:58:53
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; while (scanf("%d", &n) != EOF) { int arr[200]; in
展开全文
rainman_
发表于 2023-02-24 16:05:35
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { int n;//数组大小 int arr[2000];
展开全文
CooKing
发表于 2023-03-09 04:05:50
#include <iostream> using namespace std; int arr[230] ={0}; int main() { int n; scanf("%d",&n); for(int i=0;i<n;++i){
展开全文
帅的一天被人砍三回
发表于 2025-03-18 16:09:12
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <vector> using namespace std; int main() { int n,x
展开全文
问题信息
数组
查找
排序
难度:
103条回答
64收藏
9796浏览
热门推荐
通过挑战的用户
查看代码
海边的少年
2023-03-12 19:23:52
愿安
2023-03-12 15:49:33
快支棱起来的s...
2023-03-12 11:40:11
牛客98376...
2023-03-11 16:02:48
尾生丶
2023-03-10 23:41:54
相关试题
在下列表述中,错误的是()
字符串
树
排序
评论
(43)
如图 1 表示使用快表(页表)的虚...
编程基础
评论
(1)
对于我们来说,谁是好的顾客?
销售常识
评论
(1)
小红书用户在不同使用场景下,对内容...
需求分析
评论
(1)
订单表order_table全部记...
查找
数据库
数据分析
SQL
评论
(2)
找x
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
2 1 3 0
-1