当前位置:网站首页>D25:sequence search (sequence search, translation + problem solving)
D25:sequence search (sequence search, translation + problem solving)
2022-07-03 23:14:00 【Aggressive Wenwen】
The original title is :OpenJudge - 25:Sequence Search
translate :
describe : Given a by N A sequence of numbers . Find the smallest subscript id, send S[id] be equal to K;
Input : first line : Two positive integers N and K(N<=100,K<=100000);
The second line :N No more than one. 100000 The positive integer ;
Output : An integer id.
Code :
#include<iostream>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
int ans,a,f=1;
for(int i=1;i<=n;i++){
cin>>a;
if(a==k&&f){
cout<<i;
f=0;
}
}
return 0;
}边栏推荐
- Introduction to the gtid mode of MySQL master-slave replication
- [note] IPC traditional interprocess communication and binder interprocess communication principle
- [untitled]
- Sword finger offer day 4 (Sword finger offer 03. duplicate numbers in the array, sword finger offer 53 - I. find the number I in the sorted array, and the missing numbers in sword finger offer 53 - ii
- 3 environment construction -standalone
- Recursion and recursion
- Blue Bridge Cup -- guess age
- Hcip day 14 notes
- Can you draw with turtle?
- Druids connect to mysql8.0.11
猜你喜欢
![[network security] what is emergency response? What indicators should you pay attention to in emergency response?](/img/ff/c733ffbb922760910ab09af3ae2886.jpg)
[network security] what is emergency response? What indicators should you pay attention to in emergency response?

How to prevent malicious crawling of information by one-to-one live broadcast source server

A preliminary study on the middleware of script Downloader
![[Happy Valentine's day]](/img/d9/9280398eb64907a567df6eea772adb.jpg)
[Happy Valentine's day] "I still like you very much, like sin ² a+cos ² A consistent "(white code in the attached table)

Common mode interference of EMC

Hcip 13th day notes

Leetcode: a single element in an ordered array

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

How to restore the factory settings of HP computer

What are the common computer problems and solutions
随机推荐
Recursive least square adjustment
Recursion and recursion
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)
[automation operation and maintenance novice village] flask-2 certification
[network security] what is emergency response? What indicators should you pay attention to in emergency response?
Mongoose the table associated with the primary key, and automatically bring out the data of another table
Hcip day 15 notes
Fluent learning (5) GridView
Sword finger offer day 4 (Sword finger offer 03. duplicate numbers in the array, sword finger offer 53 - I. find the number I in the sorted array, and the missing numbers in sword finger offer 53 - ii
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
Hcip day 12 notes
[Android reverse] use the DB browser to view and modify the SQLite database (copy the database file from the Android application data directory | use the DB browser tool to view the data block file)
6.2 normalization 6.2.5 third normal form (3NF)
How to understand the gain bandwidth product operational amplifier gain
X Opencv feature point detection and matching
Pyqt5 sensitive word detection tool production, operator's Gospel
2.14 summary
Wisdom tooth technology announced that it had completed the round D financing of US $100million and had not obtained a valid patent yet
Leetcode: a single element in an ordered array