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 ...
随机推荐
- AI:IPPR的模式生成-学习/训练方式(基本结构)
前言: 一个完备的模式识别系统,必然包含一个模式识别模型,此外还要附加一个评价模型,以及为了构建识别模型而构建的学习模型,并选择在学习模型中使用的学习方法. 否则 w=w 这样,)那样 ...
- Unity与Android通信的中间件
2.1.1 Fragment和Activity都需要实现的接口——IBaseView/** * Description:Basic interface of all {@link Activity} ...
- tomcat 热加载设置
找到tomcat项目的apache-tomcat-8.0.30\conf\context.xml,打开进行编辑,把Context项中加上 reloadable="true" < ...
- Linux的环境配置文件----.bashrc文件
.bashrc文件主要保存个人的一些个性化设置,如命令别名.路径等.也即在同一个服务器上,只对某个用户的个性化设置相关.它是一个隐藏文件,需要使用ls -a来查看. .bash_history 记 ...
- Linux思维导图之进程管理
查漏补缺,理解概念,及时总结,欢迎拍砖.
- Linux系统学习之 三:新手必须掌握的Linux命令3
内容预览 1.输入输出重定向 2.管道命令符 3.命令行的通配符 4.常用的转义符号 5.重要的环境变量 一.输入输出重定向 重定向技术的5种模式:1 标准覆盖输出重定向 错误覆盖输出重定向 错误追加 ...
- CSS定位相关
CSS display:inline和float:left两者区别 ①display:inline:任何不是块级元素的可见元素都是内联元素.其表现的特性是“行布局”形式!(行布局:其表现形式始终以行进 ...
- Problem 19
Problem 19 You are given the following information, but you may prefer to do some research for yours ...
- Problem 48
Problem 48 The series, 11 + 22 + 33 + ... + 1010 = 10405071317. Find the last ten digits of the seri ...
- 3..jquery的ajax获取form表单数据
jq是对dom进行的再次封装.是一个js库,极大简化了js使用 jquery库在js文件中,包含了所有jquery函数,引用:<script src="jquery-1.11.1.mi ...