Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
29523 | zhouhuanyu 玙静 | 查找特定的值 | C++ | 通过 | 0 MS | 244 KB | 329 | 2023-10-30 21:14:35 |
#include <bits/stdc++.h> using namespace std; int a[10001]; int main(){ int n; cin >> n; for(int i = 1; i <= n; i ++){ cin >> a[i]; } int x, y = 0; cin >> x; for(int i = 1; i <= n; i++){ y = 0; if(x == a[i]){ cout << i; y = 1; break; } } if(y = 0){ cout << "-1"; } return 0; }