当前位置:网站首页>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;
}边栏推荐
- The difference between single power amplifier and dual power amplifier
- Hcip day 16 notes
- Format cluster and start cluster
- 6.2 normalization 6.2.5 third normal form (3NF)
- How can enterprises and developers take advantage of the explosion of cloud native landing?
- 2022.02.13
- AST (Abstract Syntax Tree)
- Hcip day 12 notes
- Creation of the template of the password management software keepassdx
- Gorilla/mux framework (RK boot): add tracing Middleware
猜你喜欢

SDMU OJ#P19. Stock trading

2022.02.14

How to solve the problem of requiring a password when accessing your network neighborhood on your computer

User login function: simple but difficult

What are the common computer problems and solutions

Hcip day 16 notes

EPF: a fuzzy testing framework for network protocols based on evolution, protocol awareness and coverage guidance

Unique in China! Alibaba cloud container service enters the Forrester leader quadrant

Qtoolbutton available signal

Recursive least square adjustment
随机推荐
Format cluster and start cluster
"Learning notes" recursive & recursive
How to solve win10 black screen with only mouse arrow
[Happy Valentine's day] "I still like you very much, like sin ² a+cos ² A consistent "(white code in the attached table)
NPM script
C3p0 connection MySQL 8.0.11 configuration problem
Wisdom tooth technology announced that it had completed the round D financing of US $100million and had not obtained a valid patent yet
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
2/14 (regular expression, sed streaming editor)
Op amp related - link
Es6~es12 knowledge sorting and summary
Xiangong intelligent obtained hundreds of millions of yuan of b-round financing to accelerate the process of building non-standard solutions with standardized products
Leetcode week 4: maximum sum of arrays (shape pressing DP bit operation)
Unity shader visualizer shader graph
In VS_ In 2019, scanf and other functions are used to prompt the error of unsafe functions
Pointer concept & character pointer & pointer array yyds dry inventory
Blue Bridge Cup -- guess age
IDENTITY
JarPath
How about opening an account at Hengtai securities? Is it safe?