HNH01-EDITORIAL

PROBLEM LINK:

Practice

Author: Arefin Labib

DIFFICULTY:

SIMPLE

PREREQUISITES:

Implementation

PROBLEM:

You are playing a game where you have been sent in a town to collect 10 types of coin and their symbol are defined with A,B,C,D,E,F,G,H,I,JA,B,C,D,E,F,G,H,I,J. In that town every enemy have a coin. By killing one you will get a coin from that enemy. Each enemy have only a unique coin.

The challange of the game is You have to collect all the coin and only then you will get the victory. You are a brave gamer so you took this hard challange and successfully finished it. After finishing, you are thinking of the game. You know the order off collecting coin. Now you have to find out how many enemy did you have killed?

QUICK EXPLANATION:

Just print 10 :stuck_out_tongue:

EXPLANATION:

Welcome to the easiest problem of the contest: Hey newbees, here is some honey round 1. Thats nothing but a simple logical question. Just notice-

1.You have to collect all the 10 coins to complete the mission.

2.You have successfully completed the mission.

3.Every enemy must have a unique coin.

So it is clear that you have collected the 10 coins. Now the confusion arose that If
there are some enemy who have a coin that is not among [A – J]. But notice in the
input statement. The string consists with only [A – J]. So it is clear that there is no
enemy having a coin out the range [A – J].
So, Just print 10.

ALTERNATE EXPLANATION:

Another correct answer is storing the input in a string and print it’s size.

Time complexity: O(1)

SOLUTIONS:

Setter's Solution
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

using namespace std;
int main()
{
	    int t;
    cin>>t;
    while(t>0)
    {
    string a;
    cin>>a;
    cout<<"10"<<endl;
    t--;
    }
    return 0;
}
Setter's Solution
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

using namespace std;
int main()
{
	    int t;
    cin>>t;
    while(t>0)
    {
    string a;
    cin>>a;
    cout<<a.size()<<endl;
    t--;
    }
    return 0;
}
1 Like