http://codeforces.com/gym/101933/problem/B
Baby Bites
time limit per test
1.0 s
memory limit per test
256 MB
input
standard input
output
standard output
Arild just turned 11 year old, and is currently learning how to count. His favorite thing to count is how many mouthfuls he has in a meal: every time he gets a bite, he will count it by saying the number out loud.
Unfortunately, talking while having a mouthful sometimes causes Arild to mumble incomprehensibly, making it hard to know how far he has counted. Sometimes you even suspect he loses his count! You decide to write a program to determine whether Arild's counting makes sense or not.
Input
The first line of input contains an integer nn (1≤n≤10001≤n≤1000), the number of bites Arild receives. Then second line contains nn space-separated words spoken by Arild, the ii'th of which is either a non-negative integer aiai (0≤ai≤100000≤ai≤10000) or the string "mumble".
Output
If Arild's counting might make sense, print the string "makes sense". Otherwise, print the string "something is fishy".
Examples
input
Copy
5 1 2 3 mumble 5
output
Copy
makes sense
input
Copy
8 1 2 3 mumble mumble 7 mumble 8
output
Copy
something is fishy
input
Copy
3 mumble mumble mumble
output
Copy
makes sense
#include<bits/stdc++.h>
using namespace std;
bool check(string s, int x)
{
return s == to_string(x);
}
int main()
{
int n; string s;
bool flag = true;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> s;
if(s != "mumble" && !check(s, i))
flag = false;
}
if(flag)
cout << "makes sense" << endl;
else
cout << "something is fishy" << endl;
return 0;
}