Algorithm
Problem Name: beecrowd | 2510
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2510
Batmain
By Guilherme Miranda, UNOESTE Brazil
Timelimit: 1
As everyone knows, there are many heroes who defend humanity from thugs and evil forces. In Codham, one of the darkest cities that exist, lives Batmain, the dark knight. Briefly, Batmain is nothing more than a human genius, multi-billionaire, philanthropist that also is master in over than a hundred martial arts. Although anyone knows his real identity, because he uses a armor with bat costume, all good people love him. After several battles, all his villains were captured by Batmain and the sense of security seemed to be part of the Codham citizens again. All this atypical tranquility ceased to exist in two days, when the clown prince of crime – also known as Jokoder – escaped from Arkham and made the city more chaotic than ever. You work to the police of Codham, in a recognized work of batprogrammer (job responsible to solve problems that the Batmain is envolved, with algorithms codes) and was solicited to you the following mission: answer, to each villain, if he already was arrested by the dark knight, or not.
Input
The first line of the input consists of an integer T, which indicates the number of test cases. Each test case is composed by strings with more than 0 and no more than 25 letters of the English alphabet [a-z, A-Z].
Output
If the villain have ever been captured by Batman, print Y. Otherwise, print N.
Input Sample | Output Sample |
1 |
Y |
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include <stdio.h>
int main(void)
{
int n, i;
char str[100];
scanf("%i", &n);
for (i = 0; i < n; ++i)
{
fflush(stdin);
fgets(str, 100, stdin);
printf("Y\n");
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string str;
cin >> n;
while(n--){
cin >> str;
cout << "Y" << endl;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
const number = lines.shift();
for(let i = 0; i < number; i++){
console.log ("Y");
}
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Python Programming
Code -
Python Programming
n = int(input())
while n > 0:
n -= 1
c = input()
print('Y')
Copy The Code &
Try With Live Editor
Input
Output