当前位置:网站首页>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;
}边栏推荐
- 1 Introduction to spark Foundation
- ThreadLocal function, scene and principle
- Take you to master the formatter of visual studio code
- Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
- Live app source code, jump to links outside the station or jump to pages inside the platform
- How to write a good title of 10w+?
- Ten minutes will take you in-depth understanding of multithreading. Multithreading on lock optimization (I)
- [issue 16] golang's one-year experience in developing Purdue Technology
- QT creator source code learning note 05, how does the menu bar realize plug-in?
- Runtime. getRuntime(). totalMemory/maxMemory()
猜你喜欢

Qtoolbutton available signal

In 2022, 6G development has indeed warmed up

2/14 (regular expression, sed streaming editor)

C deep anatomy - the concept of keywords and variables # dry inventory #

Current detection circuit - including op amp current scheme

The 2022 global software R & D technology conference was released, and world-class masters such as Turing prize winners attended

A preliminary study on the middleware of script Downloader

Pat grade A - 1164 good in C (20 points)

Hcip day 14 notes

2 spark environment setup local
随机推荐
[issue 16] golang's one-year experience in developing Purdue Technology
Current detection circuit - including op amp current scheme
33 restrict the input of qlineedit control (verifier)
Blue Bridge Cup -- guess age
540. Single element in ordered array
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)
2022.02.13
"Learning notes" recursive & recursive
Subset enumeration method
Quick one click batch adding video text watermark and modifying video size simple tutorial
User login function: simple but difficult
How to solve the problem of requiring a password when accessing your network neighborhood on your computer
Unsafe and CAS principle
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Text replacement demo
Bufferpool caching mechanism for executing SQL in MySQL
What are the securities companies with the lowest Commission for stock account opening? Would you recommend it? Is it safe to open an account on your mobile phone
Fluent learning (4) listview
Pan Yueming helps Germany's Rochester Zodiac custom wristwatch
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?