A. In Search of an Easy Problem
As the name suggest it is an easy problem all what is needed is to take a string s as input and print Mohamed Salah
#include<iostream>
using namespace std;
int main()
{
string str;cin>>str;
cout<<"Mohamed Salah";
}
F. N and T
In this problem we want to find a number that is divisible by t and has n digits. But we found a series of problems:
n can be 100 -> there is no data type that handles such a big number (long long take up to pow(2,64))
How can I easily get a number divisible by t
The answer is t itself and
what about multiplying the number by 10 until I get the desired length? why 10: multiplying by 10 will keep the divisibility state (2x10 is divisible by 2 and 2x10x10 is still divisible by 2....)
so the answer will be the t multiplied by 10 until I reach the desired length. -> problem 2 solved
multiplying by 10 means adding 0 to the end of the number (2x10 = 20, 330x10 = 3300)
so we can print the t followed by zeros -> problem 1 solved
but when I will print -1? the answer is if the number of digits in t is less than n as the smallest number is divisble by t is t itself
#include <iostream>
#include <vector>
using namespace std ;
int32_t main() {
int n,t;cin>>n>>t;
if(t == 10 && n== 1){
cout<<"-1";
}else{
cout<<t;
n--;
if(t == 10)n--;
for (int i = 0; i < n; ++i) {
cout<<"0";
}
}
}