Who pat the head of itself?

Let me tell you a long long story. 
In BBS, if someone created a topic, then there would follow several user reply the topic and discuss it. As you know, the first one replied the topic we called it Sofa. Why? One explanation is that Sofa is a transliteration from English "SO FAST" terms appear in the network, commonly used in the first posted with the blog posts to respond quickly, that fast, quick response, that first step occupied NO.1 seat. "Take the Sofa away" is a clear sense of the verb word, first step into the occupation quickly caught the Sofa, and then comfortably told their friends, called all the users, people came to watch, very enjoyable. Another interpretation is: second floor refers Forum Replies' second floor, take the first two letters of the word "SF", is followed into a Sofa. 
As the Sofa is very conspicuous, has a lot of people are willing to take a Sofa away even if he did not read the article. However, only a Sofa, a lot of people think they take the Sofa away, but in fact they just take the 3 or more rearward floor. If you hurry to solve with this problem, please ignore paragraph 1 before and after 2, and the some of the input and output sentences. If you are not in a hurry, you can just take a look this problem description to to kill time. 
Return to our "Sofa" story. As the war of "Take the Sofa away" became more and more popular, and many of the 3rd-floors envied the Sofas because their click speed were not so fast as the Sofas, so they cursed the Sofas or laughed at the Sofas with the sentences like "I come just for patting SF's dog head" so on. Also, when someone had taken a Sofa away they would feel good about themselves, ridicule the 3rd-floor with "3rd-floor onec thought he had taken the Sofa away". 
However, things do not turn out the way you want. Once you thought you would be Sofa and you submit "3rd-floor onec thought he had taken the Sofa away" but it turned out that you got the 3rd-floor. The similar situation would happen when you said "I come just for patting SF's dog head" and you noticed that you were exactly the Sofa. A famous story about abusing himself is happened on one called "Brother 47". Once, he was very eager to get the Sofa and pretend himself the Sofa so that he always abused the 3rd-floor, and always the 3rd-floor he was. It made he feel angry about the Sofa and he decide to abuse the Sofa with "I come just for patting SF's dog head", and after that he always took the Sofa away. 
Everytime people saw those kinds of replies, the topic would be ignored and people came to crowd the bright "Brother 47". So much fun the "Brother 47" gave us. Now we define the "Brother 47": those who think they were not the floor of the number they said but they exactly were. There could be many "Brothers 47" or none. 

Input

There were several cases, end with EOF. 
For each case, the first line contain one integer N (0<N<=10000), indicate the number of the replies; the second line contains N integers, indicate the floor number they said. 

Output

Each case with one line. If the case contain at least one "Brother 47", print the floor number they were, saparate them with space. Otherwise, print "No Mistake" instead. 

Sample Input

9
9 8 7 6 5 4 3 2 1

Sample Output

5

题意:给出n和n个数,问你那些数满足a[i]==i如果没有就输出No Mistake如果有,就输出那些a[i];

解析:弱智阅读理解题。

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int n;
int main(){
	while(cin>>n){
		int ok=0;
		for(int i=1;i<=n;i++){
			int x;
			scanf("%d",&x);
			if(x==i){
				if(!ok){
					cout<<x;
					ok=1;
				}
				else {
					cout<<" "<<x;
				}
			}
		}
		if(ok){
				cout<<endl;
			}
			else {
				cout<<"No Mistake"<<endl;
			}
	}
	return 0;
}
发布了21 篇原创文章 · 获赞 8 · 访问量 720

猜你喜欢

转载自blog.csdn.net/qq_17853613/article/details/83658000