CodeForces 136 A.Presents(水~)

来源:互联网 发布:海知智能 编辑:程序博客网 时间:2024/05/21 00:47

Description

n个人互相送礼,第i个人送第pi个人礼物,每个人只会送出一份礼收到一份礼,问第i个人收到的礼物是谁送的

Input

第一行一整数n表示人数,之后n个整数pi表示第i个人送礼物对象(1n100)

Output

输出n个整数,第i个数表示送第i个人礼物的人

Sample Input

4

2 3 4 1

Sample Output

4 1 2 3

Solution

水题,拿个数组映射一下即可

Code

#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;typedef pair<int,int>P;const int INF=0x3f3f3f3f,maxn=100001;int n,a[maxn];int main(){    while(~scanf("%d",&n))    {        for(int i=1;i<=n;i++)        {            int b;            scanf("%d",&b);            a[b]=i;        }        for(int i=1;i<=n;i++)printf("%d%c",a[i],i==n?'\n':' ');    }    return 0;}