1.Распечатать список
user_5940704881
c_cpp
4 years ago
411 B
11
Indexable
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios_base::sync_with_stdio(false);cin.tie(NULL)
int main(){
FastRead;
int t,in;
cin>>t>>in;
map<double,int>mp;
vector<double>v;
for(int i=0;i<t;i++){
double a;
int b;
cin>>a>>b;
v.push_back(a);
mp[a]=b;
}
while(in!=(-1)){
cout<<fixed<<setprecision(3)<<v[in]<<endl;
in=mp[v[in]];
}
}Editor is loading...