1 solutions
- 
  0#include #include #include // 用于std::find int main() { int n; // 序列中元素个数 std::cin >> n; // 读取元素个数 std::vector<int> sequence(n); // 创建一个整数向量来存储序列的元素 // 读取序列的每个元素 for (int i = 0; i < n; ++i) { std::cin >> sequence[i]; } int target; // 需要查找的特定值 std::cin >> target; // 读取特定值 // 使用std::find算法查找特定值在序列中的位置 auto it = std::find(sequence.begin(), sequence.end(), target); // 判断是否找到特定值 if (it != sequence.end()) { // 输出第一次出现的下标 std::cout } else { // 如果没有找到,输出-1 std::cout << -1; } std::cout << std::endl; // 输出换行 return 0;}这是错的 
- 1
Information
- ID
- 6908
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 1
- Tags
- # Submissions
- 5
- Accepted
- 4
- Uploaded By
 
       BC20260080
      
                      LV 9
                    
 @ 2024-4-13 12:59:26
    
          BC20260080
      
                      LV 9
                    
 @ 2024-4-13 12:59:26