Chri_K

P1032-P1039
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[10001];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    int sum=0;
    for(int i=2;i<=n;i++)
    {
        if(a[i]>a[i-1])
        {
            sum++;
            if(sum==k)
            {
                cout<<a[i-1]<<endl;
                return 0;
            }
        }
    }
    cout<<"NO RESULT"<<endl;
    return 0;
}
 
 
#include <algorithm>
#include <iostream>
#include<cstdio>//标准输入要加这个包
using namespace std;
int sz[40000],n,k;
int main()
{
scanf("%d",&n);
for (int i = 1;i <= n;i++)
scanf("%d",&sz[i]);
sort(sz+1,sz+n+1);
scanf("%d",&k);
for (int i = 1;i <= k;i++)
{
scanf("%d",&n);
printf("%d\n",sz[n]);
}
return 0;
}
 
 
 
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int rabit[10001];
    rabit[1] = 1;
    rabit[2] = 2;
    for(int i=3;i<=n;i++)
    {
        rabit[i]=rabit[i-1]+rabit[i-2];
    }
    if(n==1||n==2)//要考虑1,2的特殊情况
    {
        cout<<1<<endl;
    }
    else
    cout << rabit[n]-rabit[n-2]<<endl;
    return 0;
}

posted on 2020-09-08 19:17  Chri_K  阅读(99)  评论(0编辑  收藏  举报