A - Presents
Problem description
Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there.
If there's one thing Petya likes more that receiving gifts, that's watching others giving gifts to somebody else. Thus, he safely hid the laptop until the next New Year and made up his mind to watch his friends exchanging gifts while he does not participate in the process. He numbered all his friends with integers from 1 to n. Petya remembered that a friend number i gave a gift to a friend number pi. He also remembered that each of his friends received exactly one gift.
Now Petya wants to know for each friend i the number of a friend who has given him a gift.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the quantity of friends Petya invited to the party. The second line contains n space-separated integers: the i-th number is pi — the number of a friend who gave a gift to friend number i. It is guaranteed that each friend received exactly one gift. It is possible that some friends do not share Petya's ideas of giving gifts to somebody else. Those friends gave the gifts to themselves.
Output
Print n space-separated integers: the i-th number should equal the number of the friend who gave a gift to friend number i.
Examples
Input
4
2 3 4 1
Output
4 1 2 3
Input
3
1 3 2
Output
1 3 2
Input
2
1 2
Output
1 2
解题思路:输入n(n表示编号从1到n的学生总数)个数,第i个数表示编号为i的学生送礼物给编号为j的学生,要求输出编号为j的学生收到那个送他礼物的学生编号i,水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,t[];
cin>>n;
for(int i=;i<=n;++i){cin>>x;t[x]=i;}
for(int i=;i<=n;++i)
cout<<t[i]<<(i==n?"\n":" ");
return ;
}
A - Presents的更多相关文章
- CodeForces 483B Friends and Presents
Friends and Presents Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I ...
- B. Friends and Presents(Codeforces Round #275(div2)
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces483B. Friends and Presents(二分+容斥原理)
题目链接:传送门 题目: B. Friends and Presents time limit per test second memory limit per test megabytes inpu ...
- Codeforces 483B - Friends and Presents(二分+容斥)
483B - Friends and Presents 思路:这个博客写的不错:http://www.cnblogs.com/windysai/p/4058235.html 代码: #include& ...
- CF 483B. Friends and Presents 数学 (二分) 难度:1
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- codefoeces B. Friends and Presents
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- codeforces 669A A. Little Artem and Presents(水题)
题目链接: A. Little Artem and Presents time limit per test 2 seconds memory limit per test 256 megabytes ...
- Codeforces Round #275 (Div. 2) B. Friends and Presents 二分+数学
8493833 2014-10-31 08:41:26 njczy2010 B - Friends and Presents G ...
- A - Alice and the List of Presents (排列组合+快速幂取模)
https://codeforces.com/contest/1236/problem/B Alice got many presents these days. So she decided to ...
随机推荐
- 用cmd查看win8版本 激活等详细信息命令
Win+x===>选择以管理员身份运行,输入: slmgr /dlv 显示:最为详尽的激活信息,包括:激活ID.安装ID.激活截止日期slmgr /dli 显示:操作系统版本.部分产品密钥. ...
- Linux 之secureCRT连接SSH
1.登陆linux系统,打开终端命令.输入 rpm -qa |grep ssh 查找当前系统是否已经安装. 2.如果没有安装SSH软件包,可以通过yum 或rpm安装包进行安装. .3.安装好了之后 ...
- 微信小程序例子-保存图片到手机相册
微信小程序例子-保存图片到手机相册 1.关键代码 1)WXML文件 2)JS文件 saveImgToPhotosAlbumTap: function(){ // 图片必须是 https 的 var I ...
- 46.object类型
主要知识点 1.field分类 2.object field类型的存储 一.field类型分类 1.multivalue field { "tags": [ "tag1& ...
- 【ABCD组】Scrum meeting 3
前言 第3次会议在6月15日由组长在教9 405召开. 主要对下一步的工作进行说明安排,时长90min. 主要内容 讨论怎么用c#进行下一步系统的完成 任务分配 姓名 当前阶段任务 贡献时间 下阶段任 ...
- phpcms_完整版
{pc:content action="category" catid="0" num="6" siteid="$siteid&q ...
- GitLab权限介绍
访问权限 - Visibility Level 这个是在建立项目时就需要选定的,主要用于决定哪些人可以访问此项目,包含3种 Private - 私有,只有属于该项目成员才有原先查看 Internal ...
- IT培训机构的招生诈骗大曝光
作者曾在某知名IT培训机构工作过,目睹了招生欺诈,后来作者果断辞职,不能为奸商工作,助纣为虐,在此曝光,以免学生的血汗钱白交.社会上的IT培训机构手法大都一样,奸商都是有套路的.X大青鸟,X内外企IT ...
- ACDream - Lowbit Sum
先上题目: C - Lowbit Sum Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others ...
- spring-cloud-feign 使用@RequetParam报错QueryMap parameter must be a Map: class java.lang.String
这里使用spring-cloud-start-feign: 1.2.2 REALEASE版本,依赖管理器版本是 Camden.SR2 出错的原因是@RequestParam的value为empty时, ...