zoukankan      html  css  js  c++  java
  • 军事机密(Secret.pas)

    军事机密(Secret.pas)
    【问题描述】
           军方截获的信息由n(n<=30000)个数字组成,因为是敌国的高端秘密,所以一时不能破获。最原始的想法就是对这n个数进行小到大排序,每个数都对应一个序号,然后对第i个是什么数感兴趣,现在要求编程完成。
    【输入格式】
           第一行n,接着是n个截获的数字,接着一行是数字k,接着是k行要输出数的序号。
    【输出格式】
           k行序号对应的数字。
    【输入样例】Secret.in
    5
    121  1  126  123   7
    3
    2
    4
    3
    【输出样例】Secret.out
    7
    123
    121
     
     
     1 #include<iostream>
     2 #include<algorithm>
     3 using namespace std;
     4 int a[10001];
     5 int main()
     6 {
     7     int n;
     8     cin>>n;
     9     for(int i=1;i<=n;i++)
    10     {
    11         cin>>a[i];
    12     }
    13     sort(a+0,a+n+1);
    14     int k;
    15     cin>>k;
    16     for(int i=1;i<=k;i++)
    17     {
    18         int d;
    19         cin>>d;
    20         cout<<a[d]<<endl;
    21     }
    22     return 0;
    23 }
  • 相关阅读:
    Codeforces Global Round 11
    2018-2019 ICPC, Asia Najing
    Codeforces Round #675 (Div. 2) ABCDE
    AtCoder Regular Contest 104 D(卡常)
    Navigator History Location
    键盘移动div
    键盘事件
    事件的传播
    事件的绑定
    事件的委派
  • 原文地址:https://www.cnblogs.com/zwfymqz/p/6591121.html
Copyright © 2011-2022 走看看