task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Cuadrado Magico Grado 11 (PG1118)
En un pueblo hay un mago que sorprende a los niños dibujando en la arena cuadrados mágicos que tienen un número impar de filas y columnas y donde la suma de cada fila columna y diagonal es la misma e igual al número mágico M = n(n^2+1)/2. Lo que los sorprende aun más es que el cuadrado contiene los números naturales consecutivos empezando desde 1 hasta n^2.
Por ejemplo, los cuadrados que ha dibujado el mago de orden 3, 5 y 7 se muestran a continuación.
Cuadrado mágico de orden 3
2 7 6
9 5 1
4 3 8
M= 3*(3^2+1)/2 = 15
Cuadrado mágico de orden 5
9 3 22 16 15
2 21 20 14 8
25 19 13 7 1
18 12 6 5 24
11 10 4 23 17
M= 5*(5^2+1)/2 = 65
Cuadrado mágico de orden 7
20 12 4 45 37 29 28
11 3 44 36 35 27 19
2 43 42 34 26 18 10
49 41 33 25 17 9 1
40 32 24 16 8 7 48
31 23 15 14 6 47 39
22 21 13 5 46 38 30
M= 7*(7^2+1)/2 = 175
Lo que no saben los niños es que el mago utiliza el siguiente algoritmo para dibujar el cuadrado mágico.
Coloca el número 1 en la mitad de la última columna y cada nuevo consecutivo lo coloca en la casilla de la matriz que esta arriba y a la derecha de la casilla de la casilla actual. La matriz se considera “circular”; es decir, la columna a la derecha de la última se considera la primera (la columna más a la izquierda) y la fila encima de la primera se considera la última (la fila más abajo). Si durante el proceso de llenado de la matriz, una entrada ha sido ocupada, el consecutivo se coloca a la izquierda de la casilla actual.
Con este método el mago puede dibujar cuadrados mágicos de orden —número de filas y columnas— impar pero no par.
Elabore un programa que lea una línea así:
Input
de entrada con un número natural n impar
Output
y que produzca como salida varias líneas donde la primera contiene el número mágico M = n(n^2+1)/2 y las subsiguientes las filas del cuadrado mágico. Los números del cuadrado mágico se separan con un espacio.
Example
Input:
3
Output:
15
2 7 6
9 5 1
4 3 8
Input:
5
Output:
65
9 3 22 16 15
2 21 20 14 8
25 19 13 7 1
18 12 6 5 24
11 10 4 23 17 | 35,100 |
Balance Triple (TRIPPL)
There are n teams participate in a contest.
There is exactly a match between each pair of teams (result in one team wins, other loses, no draw).
A triple team (A, B, C) is balanced iff A wins B, B wins C and C wins A.
Calculate the maximum of the number of balanced triple teams.
Input
The first line contains an integer T (T <= 10^5), denoting the number of test cases.
Each of T following line contains an integer n (n <= 10^6), denoting the number of teams in each test case.
Output
Each test case, print the maximum of the number of balanced triple teams in a single line.
Example
Input:
3
3
4
5
Output:
1
2
5 | 35,101 |
Cumpleaños Grado 10 (G10186)
Los Rodríguez son una familia muy numerosa, hijos, hijas, tíos, hermanos, hermanas, sobretodo primos.
La abuela esta de cumpleaños, y toda la familia está reunida. Después del almuerzo, llega la hora de la rifa de un regalo especial entre los asistentes: grandes, chicos, hermanos, tías y primos; así que hacen una fila india, y el anfitrión de la fiesta escribe el número ganador en un papel y comienza a preguntarle a cada uno que diga un número.
Para hacer la rifa cada uno debe decir un número, entonces si el número expresado es un número primo se le debe sumar el número siguiente, pero si no lo es, se le debe restar el número siguiente; al último de la fila, como no tiene número siguiente se le sumará o restará el número anterior, dependiendo de si es primo o no.
La rifa se la ganará aquel participante cuyo número sumado o restado con el siguiente o anterior, se acerque más por encima o por debajo al número ganador apuntado, que debe estar entre 0 y 100.
Input
Consistirá en cuatro filas de datos:
La primera fila será el número de participantes < 10
En la segunda fila serán los nombres de los participantes, que deberán ser todos diferentes, separados por un espacio.
La tercera fila serán los números que cada participante ingresa para participar, los números deben ser enteros positivos comprendidos entre 0 y 100, y deben ingresarse separados por un espacio
La cuarta fila será un número entero positivo entre 0 y 100 que representará al número ganador
NOTA: PAR ESTE EJERCICIO SE RECOMIENDA TENER EN CUENTA SOLO LOS VALORES ABSOLUTOS DE LOS RESULTADOS
Output
Por la pantalla debe salir el nombre del participante que gana el regalo especial y el número original con el que ganó
Example
Input:
3
Juan pedro maria
58 31 76
88
Output:
Pedro 31 | 35,102 |
XYBALANCE Grado 10 (RF101)
XYBALANCE
Walter Smith es un reconocido científico. El cual tiene que decodificar una cadena de ADN, pero tiene un pequeño problema y por eso te ha contratado.
Input
Walter tiene un conjunto de letras las cuales representan las bases del ADN pero necesita saber si la base (x) y la base (y) están balanceadas en otras palabras Walter necesita saber si por cada x hay una y
Output
En cada cadena deberás devolver true si la cadena se encuentra balanceada y false si esta no lo esta
Example
Input:
"aaxbby"
"aaxbb"
"bbbaxyb"
"jjjxjjjy"
"fefsegesxy"
"xydawdhafw"
"aaaaaxxxxxx"
"xaxwdawyx"
Output:
True
False
True
True | 35,103 |
DE ZIMZ GRADO 10 (RF102)
DE ZIMZ
El videojuego De Zimz es un juego que permite simular la vida cotidiana de las personas en su casa. Una posibilidad que brinda el juego es la de cambiar las baldosas de la casa por un nuevo color o diseño. Para hacer más sencillo el juego, los desarrolladores quieren que todas las baldosas sean cuadradas. Adicionalmente, ellos quieren que las baldosas dividan exactamente tanto el largo como el ancho de las diferentes casas que hay en el juego. Tu tarea es encontrar la longitud máxima del lado de la baldosa cuadrada que permite dividir las dimensiones de todas las casas exactamente sin que sobre un pedazo.
Input
La entrada consistirá en una serie de líneas, cada línea conteniendo las dimensiones de diferentes casas. La entrada terminará cuando la línea tenga un 0
Output
Por línea, imprima la longitud máxima de un lado de una baldosa cuadrada que divide exactamente la dimensiones de todas las casas.
Example
Input:
2,3,4
20,10
1,2,3
2,4,8,10
0
Output:
1
10
1
2 | 35,104 |
FEISBUC GRADO 10 (RF103)
FEISBUC
La empresa Feisbuc está teniendo problemas porque las personas están colocando muchas palabras con mala ortografía en su plataforma de red social. Ellos necesitan que tú hagas un software que permita detectar las palabras con mala ortografía. Para la versión inicial han pensado en algo simple. Ellos te dan todas las palabras con mala ortografía y un mensaje de un muro, y debes determinar si todas las palabras con mala ortografía aparecen en el mensaje del muro o no.
Input
La entrada consistirá en una serie de líneas, cada línea conteniendo las palabras con mala ortografía y un mensaje de un muro. La entrada terminará cuando la línea tenga un 0.
Output
La entrada consistirá en una serie de líneas, cada línea conteniendo las palabras con mala ortografía y un mensaje de un muro. La entrada terminará cuando la línea tenga un 0.
Example
Input:
{"a", "e", "i"}, "murcielago"
{"ci", "ur"}, "murcielago"
{"muri"}, "murcielago"
{"i","h", "e"}, "murcielago"
0
Output:
true
true
false
false | 35,105 |
Cifrado en Tabla Grado 10 (FR104)
CIFRADO EN TABLA CON NÚMERO
Con el fin de proteger información se utilizan diferentes técnicas de cifrado cuyo propósito es ocultar la información real sin alterar su estructura. El cifrado utiliza claves que pueden ser iguales, esto quiere decir que con la clave que se cifra se descifra, o diferentes con la que se cifra no se descifra, o híbrida.
Se va a cifrar una conjunto de n nombres de estudiantes utilizando la clave c donde 4<c<=0 y reemplazado cada carácter por el código ASCII en Hexadecimal respectivo en bloques de 2 números, más la clave. Adicionalmente el nombre se guarda en la posición en orden alfabético de un vector.
Input
La entrada consistirá en un número que corresponde a la clave, (Entre 0 y 3. Se debe validar), y una serie de líneas, cada línea tiene un nombre. La entrada terminará cuando la línea tenga un *.
Output
Output description...
Example
Input:
2
Juan
JUAN1
Lazaro?
Pedrito
*
Output:
4C776370
4C574350
4E637C63747141
526766746B7671 | 35,106 |
PIÑATA Grado 10 (RF105)
PIÑATA
En su celebración de su octavo aniversario, Pedrito ofrece una Piñata a sus amiguitos. Él les va repartir torta, helado y pizza. Como no tiene suficiente cantidad de cada comida para todos, Pedrito decide utilizar el siguiente método para repartirla: primero les va a dar torta a los que alcancen; luego, helado a los que alcancen, asegurándose que todos niños reciban al menos torta o helado, y por último les va a dar pizza a los niños que reciban torta o helado, pero no ambos.
Elabore un programa que ayude a Pedrito a repartir la comida a sus invitados.
Input
La entrada tiene dos filas. La primera contiene los nombres de los niños que reciban torta, separados por espacios, y la segunda, contiene los nombres de los niños que reciban helado, también separadas por espacios en blanco. El primer entero en cada línea es el número de nombres en la fila. No hay nombres repetidos en las filas.
Output
Los nombres de los niños que reciban torta o pizza, pero no ambos, ordenados ascendentemente lexicográficamente.
Example
Input:
4 Sofia Pedro Pablo Yolanda
1 Pedro
Output:
Pablo Sofia Yolanda
Input2 :
4 Pedro Pablo Miguel Santiago
5 Pablo Marta Pilar Carlos Alfonso
Output 2:
Alfonso Carlos Marta Miguel Pedro Pilar Santiago | 35,107 |
LA TIENDA DE WALTER Grado 11 (RF111)
LA TIENDA DE WALTER
Walter acaba de comprar un nuevo restaurante. El problema es que este se encuentra en una calle donde solo hay restaurantes. Este quiere saber qué precio debería ponerles a sus platos principales para lograr ser la tienda más visitada.
Input
Walter ha colocado sus tres platos principales en una matriz (Frijoles, Plancha, Pastas) y al frente de cada plato un número de comensales que podrían comprar dicho plato. Y en otra matriz ha colocado los mismos platos con el precio de sus competidores. Quedando algo así.
Frijoles
Plancha
Pastas
Restaurante 1
2500
8000
6000
Restaurante 2
3000
600
600
Restaurante 3
4000
7000
4000
Frijoles
5
Plancha
4
Pastas
3
Los (;) indican que es la entrada del siguiente parámetro
Output
Tu trabajo será crear un algoritmo el cual recibido ambas matrices sea capaz de devolver una cadena con los precios de cada restaurante. Además del restaurante con el precio más bajo y ayudar a Walter a superar sus competidores.
Example
Entrada 1
{{400,2500,30000,50000}, {5200,4300,6000,8500}, {400,504,520,6300}}; {10, 20, 100, 50}
Salida 1
“{5554000,1163000,381080} – 381080”
Entrada 2
{{50000}, {6000}, {6300}}; {10}
Salida 2
“{5554000,1163000,381080} – 381080”
Entrada 3
{{2500,30000,50000}, {4300,6000,8500}, {504,520,6300}}; {{10}, {100}, {50}}
Salida 3
“{500000, 60000, 63000} – 60000”
Entrada 4
{{400,2500,30000,50000}, {5200,4300,6000,8500}, {400,504,520,6300}}; {0, 20, 0, 50}
Salida 4
“{5525000, 1068000, 372040} – 372040” | 35,108 |
EQSEL (RF112)
EQSEL
La empresa Eqsel desarrolla hojas de cálculo. Un uso común en las empresas de esas hojas de cálculo es parar calcular las ventas por sucursal y por mes. Una hoja de cálculo se puede representar como una matriz. Cada fila de la matriz, representa las ventas de una sucursal y cada columna representa la ventas de un mes. De esa manera, en la posición (i,j) de la matriz se encuentra las ventas de la sucursal i en el mes j. La empresa Eqsel necesita que desarrolles una macro que permita calcular el total de las ventas de cada mes para todas las sucursales de una tienda.
Input
La entrada consistirá en una serie de matrices. Para cada matriz, primero aparecerá la dimensión de la matriz. Después aparecerá en una línea separada cada una de las filas de la matriz. La entrada terminará cuando la línea tenga un 0.
Output
Por cada matriz, imprima, separado por comas, las ventas totales de todas las sucursales para cada uno de los meses.
Example
Input:
2
0 1
3 0
3
0 1 2
1 0 2
4 2 0
3
1 2 3
1 0 2
4 2 0
2
0 1
1 1
0
Output:
3,1
5,3,4
6,4,5
1,2 | 35,109 |
WEIS GRADO 11 (RF113)
WEIS
La empresa Weis desarrolla software pare calcular rutas de menor duración de un punto a otro en la ciudad. Para lograrlo, Weis tiene en cuenta el tráfico, la distancia y la velocidad permitida en las diferentes calles. Weis representa el tiempo que toma ir de un lugar a otro como una matriz cuadrada, es decir, una matriz que tiene el mismo número de filas que de columnas. En esa matriz, la posición (i,j) representa el tiempo que se demora para ir de un punto i a punto j. Es claro que posición (i,i), para cualquier valor de i, debe ser cero, pues para ir de un punto a sí mismo se toma cero minutos. Desafortunadamente, Weis está teniendo problemas con su software y algunas veces aparecen valores que no son cero en la posición (i,i) de la matriz. Ellos necesitan que tú les digas si hubo un problema en el cálculo de la matriz y aparecieron valores que no son cero en alguna posición (i,i) de la matriz o si todo está bien.
Input
La entrada consistirá en una serie de matrices. Para cada matriz, primero aparecerá la dimensión de la matriz. Después aparecerá en una línea separada cada una de las filas de la matriz. La entrada terminará cuando la línea tenga un 0.
Output
Por cada matriz, imprima true si la matriz tiene solamente valores 0 en la posición (i,i) para todo i, o imprima false si esta propiedad no se cumple.
Example
Input:
2
0
1
3
0
3
0
1
2
1
0
2
4
2
0
3
1
2
3
1
0
2
4
2
0
2
0
1
1
1
0
Output:
true
true
false
false | 35,110 |
PARQUEADERO GRADO 11 (RF114)
PARQUEADERO
Con el fin de mejorar la prestación del servicio de parqueadero se quieren conocer datos del comportamiento del mismo, para ello se cuenta con la siguiente información
Un callejón funciona como un parqueadero con un tamaño estático, (ver imagen), donde, por eficiencia, los carros que ingresan deben ser organizados según su hora de salida. Al llegar un vehículo al parqueadero, su dueño informa sobre la hora de salida. Luego el encargado procede a retirar los vehículos que saldrán más temprano que éste, ingresar el vehículo y luego vuelve a parquear por delante los vehículos que había retirado, siempre en orden de salida. Este proceso se repite cada vez que ingresa un vehículo al parqueadero.
Por ejemplo, si las horas de salida de los 3 vehículos que hay en el parqueadero son:
16:00 16:20 18:00 respectivamente, y llega un nuevo vehículo al parqueadero informando que saldrá a las 17:00, se deben retirar los dos vehículos que están al frente, ingresar el nuevo vehículo y luego volver a poner los dos vehículos que se habían retirado, al finalizar se tendrán 4 vehículos organizados según su hora de salida, es decir: 16:00, 16:20, 17:00 y 18:00.
Se requiere:
Conocer el estado del parqueadero cada vez que se ingresa un nuevo vehículo y el número de movimientos totales del parqueadero, además para cada vehículo llevar la cuenta del número de veces que se mueve.
Input
Input description...
Output
Output description...
Example
Input:
etc.
Output:
etc. | 35,111 |
CAOS GRADO 11 (RF115)
CAOS
Un grupo de científicos tienen un problema les han pedido analizar los datos de unos asteroideos ya que es complejo decidieron llamarte a ti para que los ayudes.
Entrada:
La entrada consta de dos enteros los cuales son la dimensión de la matriz y el número con el cual identifican la categoría del asteroide (n).
Salida:
En la salida deberás mostrar la matriz la cual se calcula con la formula (j + n) – i, además también debes mostrar la sumatoria de los elementos de la matriz, el elemento mayor y el menor
Entrad 1:
5 1
Salida 1:
-1 0 1 2 3
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
75
7
-1
Entrada 2
1 20
Salida 2:
-20
-20
-20
-20
Entrad 3:
4 2
Salida 3:
-2 -1 0 1
-1 0 1 2
0 1 2 3
1 2 3 4
16
4
-2 | 35,112 |
CALENTAMIENTO GRADO 10 Y 11 (RF01C)
LOCALES
Un centro comercial quiere dar un código de identifica a sus locales según su nombre.
Tu trabajo será hacer un algoritmo que calcule dicho código.
Input
La entrada consta de un arreglo con el nombre de los locales. Y la posición del local dado por el orden del arreglo
Output
La salida es un arreglo el cual contiene el código del local. El centro comercial para generar el código decidió sumar la posición de cada letra de la palabra en el alfabeto, la posición del local en el centro comercial. Una vez obtenidos todos los valores debes sumarlos.
Nota:
Omite la letra ñ
Example
Input:
{"CBA", "DDD"}
{"Exito", "Carulla", "Andes"}
{"Sutimax", "Remonx", "Gaming"}
{"AAA"}
{"Buñuelos", "Bigos", "Frisby"}
{"ExiTo", "CaRuLla", "AndesTres", "Asturas"}
{"Exito", "Carulla", "Andesw"}
{“Remonx”, “Éxito”}
Output:
{6, 15}
{78,89,58}
{121,104,72}
{3} | 35,113 |
Somma e dividi (LAI1819ESUMDIV)
Avete 5 interi in input. Un numero per linea. (dovete utilizzare input() almeno 5 volte)
Calcolate la somma di questi numeri. Stampate:
se la somma è pari: stampate la somma diviso 2
se la somma è dispari: stampate la somma diviso 5
Il risultato dovrebbe essere un numero decimale
Example
Input:
2
2
2
2
2
Output:
5.0 | 35,114 |
Tìm xâu 01 (MATCHSTR)
Cho xâu S và xâu T (1≤lenT≤lenS≤10
6
) chỉ gồm các ký tự 0 đến 9 đếm xem xâu T xuất hiện bao nhiêu lần trong xâu S?
Input
Dòng thứ 1 ghi xâu S
Dòng thứ 2 ghi xâu T
Output
Ghi số lần xuất hiện của T trong S
Example
Input:
123123
12
Output:
2 | 35,115 |
Sums to calculate (SUMSCALC)
Given an integer n, your task is to compute the following sums:
The sum S of the n first integers (starting from 1)
The sum S
even
of the n first even integers (starting from 2)
The sum S
odd
of the n first odd integers (starting from 1)
The sum S
squares
of the n first squares of integers (1, 4, 9, ...)
The sum S
cubes
of the n first cubes of integers (1, 8, 27, ...)
Input
The first line of the input contains an integer
T
denoting the number of test cases. The description of
T
test cases follows. Each test case is described in a single line containing the integer « n » (1 ≤ n ≤ 10
4
).
Output
For each test case, print a single line containing five space-separated integers:
S S
even
S
odd
S
squares
S
cubes
Example
Input:
3
4
5
6
Output:
10 20 16 30 100
15 30 25 55 225
21 42 36 91 441 | 35,116 |
Tricky Means (MEANSTRIC)
Given n strictly positive real numbers, your task is to compute the Pythagorean means:
The arithmetic mean « A »
The geometric mean « G » (mean of rates of growth)
The harmonic mean « H » (mean of speeds)
Figure 1: Geometric interpretation of the Pythagorean means of two numbers a and b
Input
The first line of the input contains an integer
T
denoting the number of test cases. The description of
T
test cases follows. Each test case is described in two lines: the first line contains a single integer « n » (1 ≤ n ≤ 100) indicating the number of the strictly positive real numbers and the second line contains « n » space-separated strictly positive real numbers.
Output
For each test case, print a single line containing three space-separated integers: « A », « G », « H » which are respectively the arithmetic, the geometric and the harmonic means of the given strictly positive real numbers. Each mean must be given with a precision of 10
-9
.
Example
Input:
3
5
4 36 45 50 75
6
1.0 2.0 4.0 7.0 14.0 28.0
8
1.0 2.0 3.0 4.0 9.0 12.0 18.0 36.0
Output:
42.000000000 30.000000000 15.000000000
9.333333333 5.291502622 3.000000000
10.625000000 6.000000000 3.388235294 | 35,117 |
Prime or not Prime! (PRIONPRI)
In this problem, your task is to determine if a given number is a prime number or a composite number.
Input
The first line of the input contains an integer
T
denoting the number of test cases. The description of
T
test cases follows. Each test case consists of a single line containing a single integer « n » (2 ≤ n ≤ 10
9
).
Output
For each test case, your program should output a single line containing « YES » (without quotes and spaces) if the given integer is prime or « NO » (without quotes and spaces) if the given integer is a composite number.
Example
Input:
6
16
127
256
513
2048
5097
Output:
NO
YES
NO
NO
NO
NO | 35,118 |
Trial Division (TRIALDIV)
In this problem, your task is to compute the decomposition of an integer into prime factors.
Input
The first line of the input contains an integer
T
denoting the number of test cases. The description of
T
test cases follows. Each test case is described in a single line containing a single integer « n » (1 ≤ n ≤ 10
6
).
Output
For each test case, print in a single line the decomposition of an integer into prime factors as a list of increasing space-separated integers.
Example
Input:
6
16
127
256
513
2048
5097
Output:
2 2 2 2
127
2 2 2 2 2 2 2 2
3 3 3 19
2 2 2 2 2 2 2 2 2 2 2
3 1699 | 35,119 |
Closest pairs in 1D V1 (CPOD1)
Given a array A of
n
integers (
n
> 1). Find the distance of the closest pair i.e. find the smallest value of |A
i
-A
j
| for i ≠ j.
Input
The first line of input consists of a single number
t
which determines the number of tests.
For each test case, the first line will be
n
and the second line will be
n
integers separated by spaces
Constraints
0 < t ≤ 10
1 < n ≤ 100000
-2×10
9
≤ A
i
≤ 2×10
9
Output
For each test case, print the distance of the closest pair.
Example
Input:
2
5
-2 -1 0 1 2
2
1 10
Output:
1
9 | 35,120 |
Mod (BUET19A)
Gon and Killua is playing rock, paper, scissors game. Now they are bored with the traditional rules.
So, they think to change the rule. Each of them will say a number in lieu of using fingers.
Let a number be x:
if x%3==0, it means ROCK.
if x%3==1, it means PAPER.
if x%3==2, it means SCISSORS.
The rest of the rules are the same:
for ROCK and PAPER, PAPER will win,
for ROCK and SCISSOR, ROCK will win,
for PAPER and SCISSORS, SCISSORS will win.
And if both of them are the same, it will be a DRAW.
Input
Input starts with an integer T, denoting the number of test cases.
Each case contains two integers X (Gon’s number) and Y (Killua’s number.)
1 <=
T
<= 100000
1 <=
X, Y
<= 100000
Output
For each case, if Gon win, print “GON”, else if KILLUA win, print “KILLUA” or if it is a draw, print “DRAW”.
Example
Input:
3
0 1
1 0
3 3
Output:
KILLUA
GON
DRAW | 35,121 |
GCD (BUET19B)
In this problem you need to find the G.C.D. of some numbers.
Since G.C.D. between two numbers is too mainstream you need to find the G.C.D. of all the given numbers.
Input
In the first line, there will be an integer,
N
(1 ≤
N
≤ 10
5
).
In the next line there will be
N
integers. All the given integers will be less than
10
5
.
Output
You have to print the G.C.D. of all the given numbers.
Example
Input:
5
2 4 6 8 2
Output:
2 | 35,122 |
Map (BUET19C)
In a beautiful country, there was a great university. It was called “PUET”. There was a teacher named Ajoy in that university. He used to run copy checker on everything he found.
One day during a sessional class he ran the copy checker on the students offlines.
The copy checker assigned an ID to all the submissions. Mr Ajoy knew that the submissions which had the same ID are actually the same. Now he wanted to know how many students actually solved the offline. But he has to meet someone, so he gave the task to you.
Input
The first line will contain an integer
N
(1 ≤
N
≤ 100000), the number of offlines.
The next line will contain
N
integers - the ID of each offline.
Every integer will be in the range
[1, 100000]
.
Output
Print the number of students who actually solved the offline themselves in one line.
Example
Input:
5
2 1 3 2 100
Output:
4 | 35,123 |
Prangon and String (MOZPAS)
Prangon
is a legendary programmer. But he has a weakness and it is string. To develop him in string sometimes he thinks about problems related to string.
One day he think what will be the lexicographically smallest string of length
n
in which you can only use lowercase English letters and can’t use more than
m
same letters. Can you do it for him?
Input
Input consist of two integers
n
and
m
.
Output
Output the expected string in one line. Don't forget to print end line after your output.
Constraints
1 <= n <= 10
5
1 <= m <= 10
5
m×26 >= n
For better understanding see the sample input output
Example
Input:
5 1
Output:
abcde | 35,124 |
Shahadat and Sequence (MOZSAS)
Shahadat
is a great programmer who loves sequences. All the time he thinks about sequences. He is so fond of sequences that sometimes he finds new sequences in his dreams.
One day he fell asleep and in his dream he found a new sequence, which is as follows:
(2
x
1
), (2
x
2
+ 1), (2
x
3
), (2
x
4
+ 1) ... (2
x
n
+ 1)
Where, 1 <=
x
i
<= 30, n is even number and 2 <=
n
<= 10
5
.
For simplicity, you can think it as an array (A) of n integers. Where:
A[1] = 2
x
1
A[2] = 2
x
2
+ 1
A[3] = 2
x
3
...
A[n] = 2
x
n
+ 1
You will be given the values of x
1
, x
2
... x
n
.
You have to answer
Q
(1 <=
Q
<= 10
5
) queries. In each query you will be given two integers
l
and
r
(1 <=
l
<=
r
<= n). You have to answer whether the summation of all elements of array
A
from l to r (
inclusive
) is even or odd.
Input
In the first line you will be given an integer
n
. In the next line you will be given n integers which are the values of x
1
, x
2
... x
n
. In the third line you will be given an integer
Q
. In the next Q lines you will be given two integers
l
and
r
.
Output
For each query print "
Even
" if (A[l] + a[l+1] + ... + A[r]) is even, otherwise print "
Odd
" without quotes.
Constraints
1 <=
x
i
<= 30
2 <=
n
<= 10
5
and
n
is even.
1 <=
Q
<= 10
5
1 <=
l
<=
r
<= n
For better understanding see the sample input output.
Example
Input:
5
3 2 1 2 2
3
1 3
2 5
2 3
Output:
Odd
Even
Odd | 35,125 |
Mozahid the forgetful (MOZMTF)
Mozahid
is a forgetful programmer. He is so forgetful that sometimes he forget at night the problem he solved that morning
:(
One morning he collect a number which consist of
11 digits
and do not have any leading zeroes (Example
12345678910
is correct but
01234567891
is not). He was trying to collect it from the previous year and after a long one year try he managed to collect it and it is sure that probability to find it again is near to 0%.
At the night he found that instead of writing 11 digits of the number he wrote
10
digits and unfortunately missed
1
digit. But he was sure that all the 10 digits are
correct
and the
relative order
of the digits in the number was not changed. As he is forgetful,
he forgot what was the number
. But this time fortunately he know the total sum of all 11 digits of the original number and he is also sure that the number was
maximum
among all possible way of restoring the number.
As Mozahid is frustrated about why he can’t easily remember anything, he is not interested to restore the number at the moment. Can you do it for him?
Input
First line of the input consist an integer
n
, having
10
digits.
In the second line you will be given an integer
m
, which is the sum of all 11 digits of the original number.
Output
Output a single line which is the original number.
Constraints
n
is an integer of
10
digits,
it is not guaranteed that this number doesn’t have leading zeros.
m >= sum of all 10 digits of n.
It is guaranteed that all inputs are valid and there is a solution of the problem.
For better understanding see the sample input output.
Example
Input:
1234567890
50
Output:
51234567890 | 35,126 |
Il Quinto Elemento (P3FIFELE)
Data una lista di numeri interi, restituire il quadrato del quinto elemento. Se l'elemento non esiste va restituito uno 0.
NOTA: Per leggere la lista in input si può, per esempio, usare il comando lis=eval(input()) che memorizza la lista in input nella variabile lis.
Per scrivere il risultato in output si può usare il comando print seguito dal nome della variabile che contiene il risultato.
Input
Una lista di numeri interi.
Output
Il quadrato del quinto elemento o 0 in caso la lista non sia abbastanza lunga.
Example
Input:
[3,4,2,7,3,6,12]
Output:
9 | 35,127 |
Sharmeen and the Lost Array (MOZSATLA)
Sharmeen loves array very much. Many days ago she wrote an array (of n elements and the index of this array is 1 based) in her notebook, but unfortunately she lost the notebook. She want to restore the array. The only clue she know that is if in any position(i) of the array (1<= i < n), the element in this position is greater than, equal or less than the next position(i+1) element.
Can you help her to restore the array?
Input
In the first line given an integer t (1 <= t <= 100), which is the number of test cases.
For each test case,
In the first line there will be given a positive integer n (1 <= n <= 10
5
) which is the size of the lost array. In the next line there will be n - 1 integers X
i
(0 <= X
i
<= 2).
If, X
i
= 0, then i
th
element is equal to (i+1)
th
element of the lost array.
If, X
i
= 1, then i
th
element is less than (i+1)
th
element of the lost array.
If, X
i
= 2, then i
th
element is greater than (i+1)
th
element of the lost array.
Output
For each test case you have to output the lost array in one line. If multiple solution exist then you have to print the
lexicographically smallest
one. Elements of the lost array must be
greater than zero
.
For better understanding see the sample input output.
Example
Input:
1
5
1 2 0 1
Output:
1 2 1 1 2 | 35,128 |
Jenny the GeoLover (MOZGEOL)
You may imagine a right-angle triangle by the name of Pythagoras. Geonty (a geometry lover) is a disciple of Mr. Pythagoras, found a problem for young programmers like you. In this problem, you are given the smallest side
X (in cm)
and the smallest angle
Y (in degree)
of a right-angle triangle. You have to calculate the length
(in cm)
of the hypotenuse of that triangle.
Input
Input starts with an integer
T (<= 10),
denoting the number of test cases. Each case can contain two real numbers
X
and
Y.
Output
For each case, print the case number and the length of the hypotenuse of that triangle.
Print six digit after the decimal point.
Example
Input:
3
7 30
15 30
10 18
Output:
Case 1: 14
Case 2: 30
Case 3: 32.360680 | 35,129 |
Sharmmen and Max Subarray (MOZSAMSA)
Sharmeen loves to play with Array. One day she created an array and wonder what will be the max length of a subarray (the whole array is also considered as a subarray) if difference of all the adjacent values in it are zero (0).
Can you help her to find the length of the Max Subarray?
Input
First line contains the number of test cases t (1 <= t <= 50)
For each test case,
In the first line given the size of the array, n (1 <= n <= 10^5) . In the next line given n integers, all the values in this array are in between ( -10^18 to 10^18 ).
Output
For each test case output one line, the size of the Max Subarray.
For clarification see the sample input output.
Example
Input:
1
5
1 1 1 2 2
Output:
3 | 35,130 |
Sharmeen and One (MOZSAO)
Sharmeen is a little girl and she can write only “one!”. If any one tells her to write 1, then she write “one”. If any one tells her to write 2, she write “one one!!”. If any one tells her to write 3, she write “one one one!!!”. If any one tells her to write 4, she write “one one one one!!!!”. So, The basic idea is, if someone tell her to write n, she will write “one” n times maintaining a space between any two consecutive “one” and then write n “!” marks.
Writing the same thing several time is boring, so she hired you to write a program for her which will do the same thing.
Input
First line will contain number of test cases t (1 <= t <= 50)
In each test case you will given an integer n (1 <= n <= 50000).
Output
For each test case print the expected output in one line.
Example
Input:
2
1
2
Output:
one!
one one!! | 35,131 |
Sharmeen and Even Odd (MOZSAEO)
Sharmeen is a little girl and she just learn about even number and odd number. A number id even if it is divisible by 2 otherwise it is odd. She also know how to add two positive numbers. Now she thinks if she add two number, will it be even or odd?
Can you help her to check this?
Input
First line will contain number of test cases t (1 <= t <= 50)
In each test case you will given two integer numbers A and B (0 <= A , B <= 10^50000).
Output
For each test case print “even” if the summation of A and B is even otherwise “odd” without quote in one line.
Example
Input:
2
1 2
2 2
Output:
odd
even | 35,132 |
Welcome our new VC (SEC01)
Welcome to the Programming Workshop at Sylhet International University! As a seasoned programmer and instructor, your task is to guide the new programmers through their initial steps in coding. Instead of the traditional "Hello World" program, let's give it a personal touch by printing our university name, "Sylhet International University".
Write a simple program that prints the name of our esteemed institution, "Sylhet International University".
Input
No input
Output
Print "Sylhet International University" without quotes. | 35,133 |
Sieve of Sundaram (MMFSUNDARAM)
In this problem you must implement
Sieve of Sundaram
, other solutions (algorithms) not acceptable.
Given one integer
n
, write prime numbers not greater than
n
in ascending order.
Input
One integer number
2≤n≤100000
.
Output
Print space separated prime numbers not greater than
n
in one line.
Example
Input:
7
Output:
2 3 5 7
23/06/2019 - Time limit increased. | 35,134 |
Sharmeen And C Programming (MOZSACP)
Sharmeen is a little girl who started learning “C Programming” now-a-days. She is about to write her first C program and wants to print “C Programming” without quotes in C programming language, but as she is new in programming she could not cope with printing it.
Can you do it for her?
Input
There is no input for this problem.
Output
Just print “C Programming” without quotes.
See the sample input output for better understanding.
Example
Input:
There is no input for this problem.
Output:
C Programming | 35,135 |
Sharmeen And Her Friends (MOZSAHF)
Sharmeen is a little girl who has many little cute friends. One day all of her friends came to her house. She wanted to play a game with her friends. In this game there will be two teams and each team should have equal team members. Sharmeeen and all of her friends will play the game. If you eliminate someone from playing the game he/she will cry and if Sharmeen refuse to play, all of her friends will become unhappy and Sharmeen doesn’t want that. But they can only play the game if each team have equal team members.
Given the number of friends came to Sharmen’s house, can you tell if they can play the game or not?
Input
You will be given an integer n ( 1 <= n <= 10^5 ) which is the number of friends of Sharmeen who came to her house.
Output
You have to print “yes” if they can play the game otherwise “no” without quote.
See the sample input output for better understanding.
Example
Input:
5
Output:
yes | 35,136 |
Sharmeen And Her Two Friends (MOZSAHTF)
Sharmeen is a little girl who has two close friends Samira and Rabeya. Samira loves both even and odd numbers but Rabeya loves even numbers if all the numbers are even and odd numbers if all the numbers are odd. One day Sharmeen play a game with them, she selects two numbers and calculate the difference of the numbers. Then she told Samira and Rabeya the difference of the numbers hiding the original numbers and asked them is she choose the two numbers for Samira or for Rabeya? Sharmeen will select one odd number and one even number if she selects it for Samira. If she selects the numbers for Rabeya then all two numbers will be even or all two numbers will be odd.
Given the difference of the numbers, can you tell for whom Sharmeen selects the numbers?
Input
You will be given an integer number n (0<=n<=10^5) which is the difference of the two numbers.
Output
Print “Samira” if Sharmeen selects the numbers for Samira, Otherwise print “Rabeya” without quote. Don’t forget to print new line after your answer.
See the sample input output for better understanding.
Example
Input:
5
Output:
Samira | 35,137 |
Sharmeen And Digits (MOZSAD)
Sharmeen is a little girl who loves digits very much but unfortunately she knows the only digit 0 (Zero). If you give her a number she can tell you how many 0’s are there.
Can you do it for Sharmeen?
Input
You will be given an integer n ( -10^8 <= n <= 10^8 )
Output
You have to print how many 0’s are in this integer.
Example
Input:
100604
Output:
3 | 35,138 |
Sharmeen And Leap Year (MOZSALY)
Sharmeen is a little girl who has learned about leap year a few days ago. She wrote a program to check a year is leap year or not. Her program works as follows:-
Step 1: If the year is not divisible by 4 print “Not Leap Year” otherwise go to next step.
Step 2: If the year is not divisible by 100 print “Leap Year” otherwise go to next step.
Step 3: If the year is divisible by 400 print “Leap Year” otherwise print “Not Leap Year”.
You will be given a year. Can you tell that in which step you can ensure that it is leap year or not according to Sharmeen’s program?
Input
You will be given an integer n (0 <= n <= 10^8), which is the year.
Output
You have to print the step number.
See the sample input output for better understanding.
Example
Input:
2012
Output:
2 | 35,139 |
Sharmeen And English Alphabet (MOZSAEA)
Sharmeen is a little girl who learned English alphabet very well. In her book the alphabet are in a cyclic manner, that means after ‘a’ comes ‘b’ then ‘c’ and so on. And after ‘z’ comes ‘a’ again. You can think that the letters are arranged in a circle. Sharmeen is so good at it that if anyone gave her a starting and ending letter she can tell all the letters within the starting and ending letter. For example if anyone tell him ‘y’ to ‘c’ she will tell y z a b c.
Can you do it for her?
Input
You will be given two lowercase English letters. First letter is the starting letter and the second one is the ending letter.
Output
You have to print all the letters in between starting and ending letter including them. You have to print a space between two consecutive letters. Be careful that you can not give a space before the starting letter and after the ending letter but you have to print a newline after the ending letter.
See the sample input output for better understanding.
Example
Input:
y c
Output:
y z a b c | 35,140 |
Sharmeen And Sadness (MOZSASN)
Sharmeen is a little girl who loves her father very much. She becomes happy when her father is at home, but she becomes sad if her father is not at home. Sharmeen is a little girl and she learned only about - (Hyphen) and _ (Underscore). If her father is not at home for 3 days she wrote at her notebook -_- which indicates that, she is sad at her father’s absence. If her father is absent for 4 days she wrote -_-- which is her sadness for these 4 days. Her sadness for 5 days is -_--_ and her sadness for 6 days is -_--_- and her sadness for 1 day is - and her sadness for 2 days is -_
You will be given how many days her father is not present at home. Can you write the sadness of Sharmeen?
Input
You will be given an integer n (1 <= n <= 10^5)
Output
You have to print the sadness of Sharmeen for n days.
Example
Input:
10
Output:
-_--_--_-- | 35,141 |
Sharmeen And Multiplication (MOZSAM)
Sharmeen is a little girl who recently learned about multiplication. If she hears a number she multiplies it with the previous number. At first the multiplied result is 1. After that if anyone tells her a number she just multiplies it with the previous multiplied result. For example, at the beginning if someone tell 5, then she multiplies it with 1 and her multiplied result becomes 1*5 = 5. After that if anyone tells -2, she multiplies it with 5 and her result becomes 5 * (-2) = -10. This process continues. After doing this for several days Sharmeen thought how to get the maximum possible multiplied value? Then she realized that sometimes it is possible to get the maximum multiplied value if she skip some numbers to multiply and sometimes multiplying all the numbers is optimal to get the maximum multiplied value.
So, you have the authority to skip some numbers. For example, in the above you can skip the second number, then the result will be 5, which is the maximum possible multiplied value in that case. Can you find an optimal way of selecting numbers in which multiplying the selected numbers will give you the maximum multiplied value of all possible way of selecting? You can skip all the numbers, if you do that then the result will be 1. You don’t have to print the way of selecting the numbers, just print the maximum multiplied value of the optimal way.
Input
You will be given an integer number n (0 <= n <= 9) which indicates how many numbers Sharmeen will hear. Then there will be n numbers x (-10 <= x <= 10).
Output
Print the maximum possible multiplied value in a line. Don’t forget to print new line after your answer.
See the sample input output for better understanding.
Example
Input:
5
-3 2 -2 1 -3
Output:
18 | 35,142 |
Warm Welcome to SIU (WOWTALENT)
You have been assigned the task of creating a welcoming message for a new student who has been admitted to Sylhet International University (SIU). Your goal is to write a program that displays a personalized welcome message for the new student.
Write a program that takes the name of the new student as input and prints the following message:
"Welcome [student_name] to SIU"
Input:
The input consists of a single line containing the name of the new student, which is a string containing alphabetic characters and spaces. The name will have at most 100 characters.
Output:
Print a single line containing the welcome message in the format mentioned above.
Example:
Input:
Siam Hasan Antik
Output:
Welcome Siam Hasan Antik to SIU
Note:
In the given example, the input is "Siam Hasan Antik", and the output is the corresponding welcome message "Welcome Siam Hasan Antik to SIU". Make sure to preserve the format and spacing as shown in the example | 35,143 |
Jisan the lazy person (SECLAZY)
Imagine you are hosting a programming contest at SIU, and after discussing this topic with your classmates, you have decided to award four types of prizes to the contestants, with each prize going to one person.
However, there is a lazy contestant, similar to your classmate Israk Masud Jisan, who will only be interested in participating if half or more of the total contestants receive prizes. He will not count himself as one of the contestants.
Your task is to determine whether he will choose to take part in your hosted contest or not.
INPUT:
You will have given 5 integer inputs N, A, B, C, D. Where-
N
-
Number of total contestant
s
without the lazy contestant.
A
, B, C, D
are the numbers
of prizes of type A
, B, C, D
.
OUTPUT:
There will be only a single answer YES or NO in a single line output. This YES means she will participate in the contest. And NO means he will not participate in the contest.
SAMPLE INPUT:
80 20 20 10
10
105 10 25 05 05
SAMPLE
OUTPUT:
YES
NO | 35,144 |
Goni the Geometrician (HASANCIRCLE)
Recently, Goni read a book by Plato. Inspired by Plato's life, he decided to invent a theorem related to geometry. While attempting to prove his own theorem, he encountered a problem and needs help to solve it.
Here the center of this circle is
O(0,0).
OA lies on X axis. And
CB || OA
. You have to find the area of
ABCO.
INPUT
: The first line contains two integers
x,y
, denoted the coordinate of
C(x,y).
The next line contain one integer r .denoted the radius of this circle.
OUTPUT
: Print the area of
ABCO
. The value calculated must be presented with 3 digits after the decimal point.
Sample input:
1 1
2
Sample output:
1.047
Sample input:
3 8
25
Sample output:
101.790 | 35,145 |
Fuad the wild scientist (EVENEGG)
Fuad is a wild scientist who lives beside a river in a large cottage alone. One day, while doing his job he found a beautiful and shinning looking egg in a bush. He liked it very much and bought it with him in his house. After 2 days, a dragon poped up from the egg. He was surprised and afraid. But, the dragon was so cute that he decided to keep it with him at his house.
Within few days, he came to know that dragons eat much and grow very rapidly. Every day he used to take a walk with the dragon and come back home before evening.The height of his door is only 7 feet. He figured out that if the dragon grows in that rate, one day the dragon will fail to enter into the house through door.
So, he became very worried and ask for help to only neighbour who is you! He ask you what will be the minimum height of the door at Nth day so that the dragon can enter. You have to help him by telling the minimum height of the door on Nth day.
Fuad will make the door heigher by using colomns of X feet.
Input
The inputs will be initial height of the dragon, (H, 0<H<750) and the Day, (0<n<1,000) on which he wants to know the height of the door, daily growth of the dragon,(G, 0<G<950) and the height of colomns, (X, 0<X< 2,000) using which he will make door. All units are in feet.
Output
One integet, The height of the door at Nth day.
Example
Input:
10 2 4 1
16 5 7 10
5 1 1 4
Output:
19
57
7 | 35,146 |
Antik the Numerologist (SHAMIM9)
Siam Hasan Antik is the great Numerologist in Sylhet International University . One day he wants to work with the last digit of those numbers that are multiplied by 9.
You need to help him.
Input
There are only input N (2<N<10
40
).
Output
print only last digit of 9*N.
Example
Input:
3
Output:
7
Input:
99
Output:
1 | 35,147 |
Add Days (SHADDAYS)
Ovi, our beloved Senior brother. He has to do a lot of
dateTime
calculation in his busy life. He always wants to know the date after x days. He wants to give less effort to do this calculation. Can you make it easy for him?
Input
The first line contains one integer t (1 <= t <= 100) – the number of queries. The first line of each query contains a date in
dd-mm-yyyy
format, which is a valid date. The next line contains x (1 <= x <= 9999) number of days required to add with given date.
Output
Find out the corresponding date after
x
days. See the format in example.
Example
Input:
3
10-12-2020
12
29-02-2016
1010
03-12-2019
120
Output
22-12-2020
05-12-2018
01-04-2020 | 35,148 |
Most Occurrence (SHOCCUR)
Given a string
S
of length
n
and
q
queries. In each query, You have to find out which character occur most of the time in a given range (L, R). If there are several answers, you have to find out the lexicographically smallest letter.
Input
The first line will contain two integers n, q (1 ≤ n ≤ 10
5
, 1 ≤ q ≤ 10
5
), the length of the string and the number of queries respectively. The next line contains the string S.
Next q lines will contain two integers L and R.
Output
For each query, find out the most occurring character and the occurrence count. If there are several answers, you have to find out the lexicographically smallest character.
Example
Input
13 5
abbacccdefgha
1 13
1 10
3 6
11 12
8 12
Output
a 3
c 3
c 2
g 1
d 1 | 35,149 |
Sum of Something (OVISOD)
You are given an array
a
consisting of
n
integers. You need to find the sum of all the common divisors between the given integers.
For example: suppose the given numbers are 4, 6 and 8. The common divisors between them are 1 and 2. So the answer will be 3.
Input
The first line of the input will contain the number of test cases t (1 <= t <= 10).
For each test case, there will be two lines of input. First line will contain the number of integers in the array n (1 <= n <= 10
5
). The following line will contain the n integers a[1], a[2], a[3] ... a[n] (1 <= a[i] <= 10
9
) where a[i] is the i-th element of the array a.
Output
For every test case print just one integer in a new line, the sum of all the common divisors between the given integers.
Example
Input:
3
3
4 6 8
2
15 13
1
5
Output:
3
1
6 | 35,150 |
Sharmeen can do it. Do you? (MOZSAP)
Sharmeen, a little girl learned C programming recently. She can print anything in this programming language. Can you do the same as Sharmeen?
Input
There is no input for this problem.
Output
Just output ‘Print \C Programming’ without quotes.
Example
Input:
Output:
This is just a demo output | 35,151 |
Sharmeen and binary number (MOZSABN)
Sharmeen, the little girl learned about binary numbers recently. But she is unable to handle it, if the number becomes large. Her friend Mozahid gave her a task to find the number of set bits in a given binary bumber. As the number can be very large, she can’t cope with the solution of this problem. As a programmer, it’s your duty to help her.
A binary number is a number which contains only ‘0’ and ‘1’. Set bit means the bit which have the value ‘1’. For example a binary number ‘1011’ has 3 set bits.
It can contain leading zeros.
Input
Given a large binary number of length n. It can have at most 10
5
digits.
Output
Output the number of set bits in the binary number.
Example
Input:
1011
Output:
3 | 35,152 |
Sharmeen and the day of week (MOZSATDOW)
Sharmeen, the little girl recently learned about the days of week(Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday). Now she wonder what will be the day of week after X days id, given today is Friday.
Input
An integer X.
Output
Print the day after X days. Let today is Friday.
Constraints
0 <= X <= 10
9
Example
Input:
0
Output:
Friday
Input:
1
Output:
Saturday | 35,153 |
Sharmeen and the distribution (MOZSATD)
Sharmeen, the little girl has a friend named Mozahid. It is Eid day and they collect ‘Salami’s :P from their relatives. But as they are good friends, they want to divide the total amount of taka into two equal parts. But every time it is not possible, so they came with a solution. They can give any ‘salami’ to any poor people to help him, but there is a restriction. If they give a ‘salami’ to a poor, they have to give the whole ‘salami’. After helping the poor, they can add all the ‘salami’ amounts and divide it into two equal parts if possible, there is no restriction. But the divided amount must be integer. For example if the ‘salami’s are {3, 5, 1} you can’t divide (3+5+1)=9 into two equal parts. But if you give 5 taka to a poor people you can divide (3+1) = 4 into two equal parts 2 , 2. They want help the poor people(They are also allowed not to help any) in such a way that, the amount they get after dividing the remaining amount into two equal parts is maximum possible.
Input
The first line of the input is an integer n which is the number of ‘salami’s.
The next line contains n integers A[i] which are the amount of each ‘salami’.
Output
Output the amount Sharmeen will get after distribution.
Constrain:
1 <= n <= 10
5
1 <= A[i] <= 10
9
Example
Input:
3
8 2 5
Output:
5
Explanation:
As (8 + 2 + 5) = 15, which can’t be divided into two equal parts. They can give 5 taka to any poor people and divide the rest total into two equal parts. (8 + 2) = 10 , 10 / 2 = 5 . So, Sharmeen will get 5 taka. | 35,154 |
Sharmeen and the commas (MOZSATC)
Sharmeen the little girl recently learned about string. She found a long string from a book. The string contains characters from ‘a’ to ‘z’, ‘0’ to ‘9’ and commas(,). Now she wonder what will be the length of the largest substring of this string which will contain at most K commas? As she is not a programmer, can you do it for her?
Input
You will be given a string of length n( 1 <= n <= 10^5) in the first line.
In the second line you will be given an integer K( 0 <= K <= n ), which is the maximum number of commas allowed in the expected substring.
Output
Output the length of the largest substring.
Constrain:
1 <= n <= 10^5
0 <= k <= n
Example
Input:
a,b,a0,3hg,0,,,sdfghijfh06
3
Output:
15
Explanation:
The expected substring is “0,,,sdfghijfh06” which has a length of 15.
There may be more than one optimal substring, but you don’t need to think about that, you have to just print the length of any optimal substring. | 35,155 |
Sharmeen and parentheses (MOZSAPAR)
Sharmeen the little girl learned about parentheses a few days ago. So as usual Mozahid gives her a problem to solve related to parentheses. As she is a little girl, she can’t find a solution. As you are a good programmer can you solve it for Sharmeen?
You will be given a string consisting of only parentheses ‘(‘ or ‘)’ and question marks ‘?’. You can replace a question mark with an opening or closing parenthesis. If it is possible to make the string a valid parentheses sequence, output yes otherwise no.
You have to replace all the question marks with parentheses
.
Input
First line of the input is the number of test cases T (1 <= T <= 10^5).
A string of length n (1 <= n <= 10^5) consisting of only ‘(‘ , ‘)‘ or ‘?’.
Total length of all string will be at most 10^6.
Output
For each testcase, if it is possible to make the string a valid parentheses sequence replacing the ‘?’ marks with parentheses output ‘yes’ otherwise ‘no’ without quotes in one line.
Constraints
1 <= T <= 10^5
1 <= n <= 10^5
Total length of all strings will be at most 10^6.
See the sample input output for better understanding.
Example
Input:
2
(()??((??)
((??
Output:
yes
yes
Explanation:
Possible valid parentheses sequences for test case 1 are:-
(())((()))
(()()(())) | 35,156 |
Sharmeen and the strange keyboard (MOZSATSK)
Sharmeen’s grandfather had a strange long keyboard. The keyboard is so long that standing on a key of the keyboard sharmeen can only reach it’s adjacent at most two keys. You can think the keyboard as a string and every character in the string a key of the keyboard. So if she is now in position i of the string she can be able to reach only the positions i-1,i-2,i+1,i+2 if there exist such position of the string. The string contains only digits from ‘0’ to ‘9’ and any of these digits can appear more than once in this string. Though in real world there is no existence of such keyboard, you can think it is imaginary and just for solving problem with fun.
Sharmeen has a limitation that she forget quickly and continuously. If now she know digit x , in the next minute she know only digit x , x-1 , x+1. If x = 0 then she know 0 , 9 , 1 in the next minute and if x = 9 , then she know 9, 8, 0 in the next minute. You can assume that she never press any key if she doesn’t know the digit of that key. She always know the first character of the string.
After pressing a key she can press the next key exactly one minute later and pressing any key takes no time.
You have to print ‘yes’ if she will be able to press the last key of the keyboard and minimum minutes required to press it. Otherwise print ‘no’ without quotes.
Input
A string S consists of only digits from ‘0’ to ‘9’ of length n( 1 <= n <= 10^5 ).
Output
Output your answer as mentioned above.
Constrain:
1 <= n <= 10^5
See the sample input output for better understanding.
Example
Input:
5495
Output:
yes
2
Explanation:
At the beginning sharmeen presses S[0], it takes no time.
In the next minute Sharmeen can press S[1].
In the second minute Sharmeen press S[3].
Thus able to press the last key in 2 minutes. | 35,157 |
Sharmeen and counting letters (MOZSACL)
Sharmeen is little girl but familiar with English letters. She is so expert that she is able to cope with any problem related with letters. So her friend Mozahid gives her a challenge to solve an interesting problem related with letters and she easily solved it. As you are a good programmer can you do the same as Sharmeen?
You are given an string of letters of length n (1 based index). At the beginning all the letters in that string are ‘#’. There exist two types of query:
Update X V
Query L R V
Update X V:
Find d, where d = lowest divisor of X which is greater than 1 and replace all the positions (d^1, d^2, d^3, d^4, …. ), with letter V.
Query L R V:
Find how many letter V are in the range of position L to R (inclusive).
There will be q such type of query.
Input
First line contains the input string of length n, which contains only character ‘#’.
Second line of the input is the number of query q.
Then there will be q queries, which can be any of the two types mentioned above.
Output
For each query of type 2 output the number of occurrence of letter V in the range L to R(inclusive).
See the sample input output for better understanding.
Constrain:
1 <= n <= 10^5
1 <= q <= 10^5
2 <= X <= 10^7
1 <= L <= R <= n
‘a’ <= V <= ‘z’
Example
Input:
##########
4
Query 1 5 a
Update 2 a
Query 1 5 a
Query 8 8 a
Output:
0
2
1 | 35,158 |
Mad Mod (NUMTHEO01)
Moduling(%) is a famous operation in programming world.Sometimes kids love to mod(%) a number by another number.They also love
to calculate factorial as factorial is a seuential multipling process.But they noticed to calculate (70!) the scientific calculator
returned "Math Error".And started to crying.Stop their crying by solve this problem.
Moduling(%) is a famous operation in programming world.Sometimes kids love to mod(%) a number by another number.They also love to calculate factorial as factorial is a sequential multiplying process.But they noticed to calculate (70!) the scientific calculator returned "Math Error".And started to crying.Stop their crying by solve this problem.
Input
The first line contains t (1<= t <=15) the number of queries.The first line of each queriy contains two integers n and x (n is less than 8388700 and x is less than 10^15) where n is for getting factorial value and x is moduling value.
Output
Your task is to calculate (n!)%x.
Example
Input:
3
5 7
10 231
1 1
Output:
1
21
0
Note:Here in first input 5!=1*2*3*4*5 or 120.Then 120%7=1. | 35,159 |
Worst Mango (NUMTH02)
An owner of the godown of mangoes is facing a great problem.He has enough employer but being the amount of worst mango so much larger,they are in trouble to calculate.They have to do the operations in daily are given below:
1.There are ' b^n ' buckets in the shop.They have to put the buckets in several rooms eually.
2.Extra buckets contain worst mangoes.But sometimes extra buckets are not enough to store those.
These are enough hard to complete the task for the employers.
An owner of the godown of mangoes is facing a great problem.He has enough employer but being the amount of worst mango so much larger,they are in trouble to calculate.They have to do the operations in daily are given below:
1.There are ' b^n ' buckets in the shop.They have to put the buckets in several rooms eually.
2.Extra buckets contain worst mangoes.But sometimes extra buckets are not enough to store those.
These are enough hard to complete the task for the employers.
Input
The first line will contain b,n,r (1 <= b , n <= 10^6) and (1<= r <= 5000) where b^n is amount of buckets and r is amount of rooms.
Second line will contain p (1<= p <= 50) the partitions or places where the worst mangoes are.
Next p lines will contain the amount of worst mangoes (1<= xi <= 10^18) in each partition.
Output
Print the amount of extra buckets and amount of extra worst mangoes which are not enough to store in bucket eually.
The answer must be exists!!!
Example
Input:
2 3 5
3
2
4
4
Output:
3 1
Note:The number of buckets are 2^3 or 8.As there are 5 rooms,so after putting them eually in each room the extra buckets are 3.In three partions or places total worst mangoes are 2+4+4 or 10.As there are 3 buckets so 10%3 or 1 mangoes is extra to store those in buckets eually. So the answer is 3 and 1 ,the number of extra buckets and mangoes. | 35,160 |
GCD!!! (NUM06)
You are given two number.Find out the Greatest Common Divisior or GCD.Let's see how we can determine GCD of two numbers.
n=min(m,n);
if m=20 and n=5,then min(m,n)=5; Now there are only 5 from 1 to n, who is divisior of both(20 and 5) .So gcd(20,5)=5.
Attention: Do not use any library function.
Input
Every line wil contain two number m,n (1<=m,n<=10^18).
m,n=0 will terminate the programme.
Output
Print the GCD of two number.
Example
Input:
5 6
3 9
10 2
0 0
Output:
1
3
2 | 35,161 |
Sum Of Divisiors (NUM08)
Number Theory Episode 1 is going to be finished by this problem.How many times you can divide a even number by only prime numbers? And finally there will be no non-prime number.Just do it! OOpsss....also you have to find out the sum of all non-prime and prime divisiors.
Input
The first line will contain t (1<=t<=100) the testcases.
next each line will contain even number n<=10^14.
Its sure that answer must be exists.
Output
Findout the number of prime factors.Print prime numbers as lowest as possible.
Last line will print the sum of divisiors as the note has made.Print endline between two results.If there are no prime numbers print only the sum of all divisiors.
Example
Input:
3
8
32
56
Output:
2 3
2 3
Sum Of Divisiors: 15
2 5
Sum Of Divisiors: 63
2 3
7 1
Sum Of Divisiors: 120
Note: in second case For 32.We can say 32=2^5.So print 2 5.
and all the divisiors are 1 2 4 8 16 32 and sum of all are 63.
Sum Of Divisiors: 15
2 5
Sum Of Divisiors: 63
2 3
7 1
Sum Of Divisiors: 120
3 1
19 1
Sum Of Divisiors: 8 | 35,162 |
I Love You (ILOVEYOU)
Make a program to print out the string
"I Love you x times"
, with x is variable that refers to an integer value.
Input
The input consist of only one line, the number x (integer).
Output
Print the string based on the description.
Example
Input:
3000
Output:
I Love you 3000 times | 35,163 |
Maximum of Ten (MAX10)
Create a program to determine the maximum/biggest value from ten integers. All integers are non-negative.
Input
Consist only of one line. All ten integers that separated by space.
Output
Print the string
"Bilangan terbesar: "
followed by the maximum of ten integers.
Constraint
All integers will have value less than 10
10
Example
Input:
3 3 2 1 1 7 6 7 1 7
Output:
Bilangan terbesar: 7 | 35,164 |
Volume of a cylinder (VCYLINDER)
Gilbert is a diligent boy. Today he and his friend, Hilmy are studying something about geometry. They are learning the formula to calculate the volume of a cylinder. Since both of them are programmer, they decide to create a program.
Use PI = 3.14
Input
Input consist of one line. There are two integers d and t, the diameter and the height of cylinder in cm.
Output
Print the volume of the cylinder with accuracy of 1/100, then followed by a string
" cm^3"
.
Example
Input:
3 10
Output:
70.65 cm^3
Constraint
1 <= d, t <= 100 | 35,165 |
Palindrom of Number (NUMPDROM)
Create a program to determine whether an integer is a palindrome. Print "YA" if the number is palindrome, otherwise print "TIDAK". A number is considered a palindrome if the value of original is the same as its reversed form.
Input
An integer n.
Output
Print the string according to the description above.
Example 1
Input:
1221
Output:
YA
Example 2
Input:
1123
Output:
TIDAK
Constraint
The number will always less than 100000 and positive. | 35,166 |
Aby and Land Plan (LANDPLAN)
Aby is designing a rectangular land plan with a side length of N meters. For this reason, he wants to create a program to visualize the landform he wants.
Input
Input consist of multiple test case. The first line of input is T, denote the number of test case. The following T lines, there is only one integer N, the side length in meter.
Output
For every test case, print the visualized rectangular land plan. For the exact details, please look at the example.
Example
Input:
3
1
2
5
Output:
#
##
##
#####
#...#
#...#
#...#
#####
Constraint
1 <= N <= 100 | 35,167 |
Italian Dinner (VZLA2019I)
Elizabeth and Veronica (Eli and Vero) are always traveling around the world, visiting new countries, going to interesting places and, of course, many restaurants to try the cuisine!
This time they are in Italy! They learn new things everyday, and today they learned the structure of the traditional Italian meals. They usually consist of five components, or
courses
:
The antipasto
The primo
The secondo
The contorno
The dolce
For every course, there is a set of options the consumer can choose from. It is an Italian tradition to ask for exactly one option of each course.
Eli and Vero want to know how many different dinners they can ask, given how many options the restaurant offers for each course. Also, they will ask for something to drink, so they will add themselves their own course:
the bevanda
.
Input
The first and only line of the input consists of six integers C
i
separated exactly by a single white space, representing the number of
antipastos, primos, secondos, contornos, dolces
and
bevandas
Eli and Vero can choose from respectively.
Output
Print the number of different dinners Eli and Vero can order.
Example
Input:
1 1 1 2 1 1
Output:
2
Input:
2 3 1 2 4 1
Output:
48
Input:
5 10 2 8 7 4
Output:
22400
Constraints
1 ≤ C
i
≤ 50 | 35,168 |
Jump! (VZLA2019J)
Oh no! You were just chillin' in the fields minding your own business, when a huge catastrophe occurred. Being a dinosaur, you would expect a giant meteor or some other world--ending calamity. But it was worse! Ohh, so much worse! There was no internet connection.
A sudden urge fills you and you feel the need to run and jump over every cactus you see. You are quite good at jumping cacti, but can't jump two cacti in a row (that is, two cacti that are at a distance of 1 from one another). If you try to jump over two such consecutive cacti, you will crash into the second one and be forever without memes.
Input
This first line of the input contains the number of tests cases T.
T test cases follow.
Each test case contains two lines. The first of these line contains a single positive integer K: the number of cacti in your way. The second line will contain K space--separated integers C
i
, representing the positions of each cactus. You can asume all cacti will be in a straight line and no two cacti will be in the same position.
Output
For each case, print a single line containing the case number (see sample output for format) and "Survival!" if you can jump over all cacti or "Oh no!" otherwise.
Example
Input:
2
5
1 4 7 10 15
5
1 5 6 20 34
Output:
Case #1: Survival!
Case #2: Oh no!
Constraints
• 1 ≤ T ≤ 10
3
• 1 ≤ K ≤ 10
3
• 0 ≤ C
i
≤ 10
3
• The cacti positions will be given in ascending order | 35,169 |
Quadratic Equation (QUADEQ)
Given a, b and c in quadratic equation (
a*x
2
+ b*x + c = 0
), find all real roots.
Input
You are given 3 integers:
a
,
b
and
c
.
-1000 <= a, b, c <= 1000
a != 0
Output
Print the number of real roots, followed by the values of the real roots in ascending order (if they exist).
Your output will be considered to be correct if the difference between your output and the actual answer is not more than 10
−6
.
Example
Input:
-1 0 2
Output:
2
-1.414213562 1.414213562
Input:
1 2 3
Output:
0
Input:
1 -8 16
Output:
1
4 | 35,170 |
input24021986 (DRSTWN)
Given two natural numbers (both not greater than 200), each number in the separate line, please print the sum of them.
Input
Input: 2 natural numbers.
Output
Output: 1 natural number.
Example
Input:
4 5
Output:
9 | 35,171 |
A very hard problem to crack (PRANAVHPTC)
Mujahid and Hasan went to Mirpur National Stadium to enjoy Bangladesh vs India cricket game.
There are N seats in total, but the seats are arranged in a circular way.
In the mean time Mujahid lost Hasan. But Mujahid has been able to Locate Hasan over Mobile Phone.
Now Mujahid wants to know minimum distance between them. Can you help him ???
Mujahid's Location is A, Hasan's Location is B.
Input
The first line contains positive integer t (1 ≤ t ≤ 1000) — the number of test cases. Next t lines contain the descriptions of test cases.
Each line contains three positive integer N, A, B. (1 <= N <= 10^14).
Output
For each testcase print a number which will be the minumum distance between Mujahid and Hasan's position.
For more understanding see the picture below, which is for the testcase where, N = 9, A = 2, B = 4.
Example
Input:
4
9 1 3
8 4 5
5 1 2
8 2 4
Output:
2
1
1
2 | 35,172 |
Spending Money (HASANSM)
Hasan has P taka. He goes a chocolate shop. The chocolate shop has only 'Kitkat' and 'Dairy Milk'. The price of a single 'Dairy milk' is M taka and a single 'Kitkat' is N taka.
If any person wish to buy 'Dairy Milk', he/she must buy exactly 1 or 2 or 4 or 8 'Dairy Milks' at a time.
If any person wish to buy 'Kitkat', he/she must buy exactly 7 or 14 or 28 'Kitkats' at a time.
Hasan wants to spend as much money as he can. As, Hasan is weak in mathematics, he wants your help.
Now, you need to calculate the minimum remaining money that Hasan will have after buying chocolates.
Input
First line contains a positive integer T, which is the number of test cases.
In each test case there will be three integers P, M, N.
1 <= T <= 25
1 <= P <= 3*10^10
30 <= M, N <= 10^10
The summation of all P in all test case will not exceed 1.2*10^11
Output
For each test case print the minimum money that Hasan will have after buying chocolates in one line.
See the sample input outout for better understanding.
Example
Input:
3
150 30 35
167 40 35
99999989 31 31
Output:
0
7
3 | 35,173 |
The ACM ICPC Problem (MOZTAIP)
Fahim, Riyad and Anik are 3 programmers of ACM ICPC Team "Cou_FaRiAn".
They want to print a line "Competitive\tprogramming\n" without quotation mark. But got wrong answer.
Can You solve it ??
Input
There is no input for this problem.
Output
Print the line which will be the output of the problem.
Example
Input:
no input
Output:
Hello World | 35,174 |
Even Odd (MUJEO)
Farabi loves mathematics very much. He wants to play with numbers, specially with even and odd numbers.
One day he gets a line and an idea came to his mind.
He wants to assign the numbers in the line in the non-decreasing order but in different manner.
He wants to assign:
The even numbers in the odd indices and odd numbers in the even indices.
All the even numbers must be in the non-decreasing order and also all the odd numbers must be in non decreasing order, means the even numbers will not change their relative position and vice versa.
As example: substituting value (2 and 4) in index (1 and 3) respectively, and value (1 and 3) in index (2 and 4) respectively. The sequence will look like the following,
2, 1, 4, 3, 6 ...
After doing this he shows that to his teacher Mr. Jhon But instead of appreciating him Mr. Jhon gave him another task:
"The task is to find the summation between two indices (a and b)".
After trying this more than a day Farabi become frustrated and He wants your help to solve this problem.
can you help him?
Input
In the first line there will be an integer T (1 <= T <= 10) the number of test cases.
In each test case there will be two integer a and b.
1 <= a, b <= 10^9
Output
For each test case print the output in one line.
Example
Input:
2
1 4
1 1000000000
Output:
10
500000000500000000 | 35,175 |
Geometry (MUJGEO)
Farabi is good at Geometry.
And he loves to make challenge.
He gave two triangle (ABC and CAD) where there is a common side and two side are parallel to each other.
Here you can see the following figure for better realization.
Input
You will be given angle BAC, ABC and side BC and AD .
Here, pi = acos(-1.0)
Output
Find the area of the circle CDE. Your answer will be considered correct if the absolute difference between your and judge's solution will not differ more than 10^(-6).
Example
Input:
10 30 40 50
Output:
19311.6239189261 | 35,176 |
(MUJDLT)
| 35,177 |
(MUJDOLT)
| 35,178 |
Do Not love them (MUJDONLT)
Farabi is a very attentive student and as usual he gets CGPA 4 out of 4.
On these behalf he wants to arrange a party.
Though he is a good student he isn't a good person of pure heart. He hates too many people.
But the reason behind his hating other people are weird.
His roll number is the last roll number in the class and it also indicates the number of students present in his class where the roll number starts with 1.
He hates the person with roll number with whom the common divisor is equal to or greater than 2.
He doesn't want to invite them.
But he is confuse with the number of people he is going to invite.
Can you help him?
Input
There will be only one line of input which is an integer n (1 <= n <= 10^9).
Output
Output the expected result in one line.
Example
Input:
1
Output:
1 | 35,179 |
Valid Parentheses (MOZVAPA)
Prangan Found a parentheses sequence while walking along the road of Comilla University.
He wants to make the sequence as a valid parentheses sequence, because he learned it from his room-mate
Mozahid last night. Prangan made the sequence valid very easily. But Mozahid now made it a bit tricky
for Prangan. He told Prangan to make a substring of the sequence valid. He will give the left and the
right position (L and R) of that substring. And he will ask it Q times.
As Prangan is not good at Programming like you, he is seeking help from door to door.
Please Help him.
Note to mention that: a valid parentheses sequence is a parentheses sequence that can be transformed into a correct arithmetic expression
by inserting characters "1" and "+" between the characters of the string. For example, parentheses sequences "()()", "(())" are
correct (the resulting expressions "(1)+(1)", "((1+1)+1)"), and ")(" and "(" are not.
Input
The first line contains positive integer t (1 ≤ t ≤ 100) — the number of test cases.
Each test case contains a positive integer N (1 <= N <= 100000), which is the length of parentheses sequence Prangan Found.
Next Line contains a non-empty string S consisting of only characters '(', ')'.
Next Line contains a positive integer Q (1 <= Q <= 100000) denotes the number of queries.
In each query there will be two positive integer L and R (1 <= L <= R <= N). Summation of all N will not be greater than 500000.
Output
For each query you have to print "YES" if it is possible to make the sequence valid rearranging parentheses in between position L to R.
See the sample output below for better understanding.
Example
Input:
etc.
Output:
etc. | 35,180 |
Riyad And His Increasing Array (RAHIA)
You are given an array of
N
integers.
In this array in a single operation, you can choose any i (where
1
<=
i
<=
N
) such that
a[i]>0
and decrease
a[i]
by
1
.
You have to determine is it possible to make the given array
sorted
(
strictly increasing
) after using some number of operations (
possibly 0
) described above.
Input
Input starts with an integer N (1 ≤ N ≤ 100000), number of elements of the array.
Next line contains N separated integers a
i
(1 ≤ a
i
≤ 10
9
).
Output
Print "YES" (without quotes), if you can make the array
sorted
(
strictly increasing
), otherwise print "NO".
Example
Input:
7
5 2 3 9 88 9 10
Output:
YES | 35,181 |
FEASTOFPIGS (MOMOS)
The pig's are having a feast tonight!! There are
N
momos numbered from 0 to
N - 1
. They are all arranged in a row on a table. Also
K
pigs are attending the feast. The
j
th
pig has hunger
a[j]
. A pig with hunger
a[j]
only eats all momos with number i such that when
i
is divided by
a[j]
, the remainder is 0. For example, if there are 20 momos and a pig has hunger 3, then the pig will eat momos at position 0, 3, 6, 9, 12, 15, 18.
Once a momo at a particular position is eaten by one pig, it cannot be eaten by a different pig.
Your task is simple, given the number of momos, and hunger of
K
pigs, find the total number of momos left after the feast.
Input
The first line of the input contains two integers N and
K
, where
N
is the number of momos and K is the number of pigs. Lines 2, 3 ... K + 1 describe the hunger of
K
pigs. Line
i + 1 (1 ≤ i ≤ K)
contains a single integer representing the hunger of the
i
th
pig (i.e.
a[i]
).
It is guaranteed that:
either (1 ≤ N ≤ 10
6
and 1 ≤ K ≤ 100) or (1 ≤ N ≤ 10
14
and 1 ≤ K ≤ 20)
The hunger of every pig lies between 1 and
N
.
Output
A line containing a single integer, which is the number of momos left on the table after all pigs have finished eating.
Example
Input:
20 3
3
6
5
Output:
11 | 35,182 |
Praktikum 4 SDF A (SDF4A)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,183 |
Praktikum 4 SDF B (SDF4B)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,184 |
Praktikum 4 SDF C (SDF4C)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,185 |
Praktikum 4 SDF D (SDF4D)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,186 |
DIVISORES PALINDROMOS (DIVPALI)
Los divisores de los números nos pueden dar características muy especiales de el, por ejemplo un numero donde sus únicos divisores son 1 y si mismo es un numero primo, por otra parte, un numero que es divisible exactamente por 2 es un numero par, es por ello que se le encomendó la tarea de encontrar un rasgo especial dado un numero
N
, usted recordó que existe un tipo especial de número llamado palíndromo, este es un numero que escrito de izquierda a derecha es idéntico que al escribirlo de derecha a izquierda, por lo tanto decidió buscar si existe un patrón con los divisores de un numero
N
, buscando y mostrando cual de sus divisores cumple con esta característica.
Los divisores de los numeros nos pueden dar caractersticas muy especiales de el, por ejemplo
un numero donde sus unicos divisores son 1 y si mismo es un numero primo, por otra parte,
un numero que es divisible exactamente por 2 es un numero par, es por ello que se le encomend
o la tarea de encontrar un rasgo especial dado un numero N, usted recordo que existe
un tipo especial de numero llamado palndromo, este es un numero que escrito de izquierda
a derecha es identico que al escribirlo de derecha a izquierda, por lo tanto decidio buscar
si existe un patron con los divisores de un numero N, buscando y mostrando cual de sus
divisores cumple con esta caracterstica.
Input
La entrada del programa consiste en un único numero entero
N
, donde
N
> 0.
Output
La salida de nuestro programa consiste en una lista de números separados por coma. Donde cada uno de los números son divisores del numero
N
y cumplen con la característica de ser palíndromos y un salto de linea.
Example
Input:
121
Output:
1,11,121
Input:
66
Output:
1,2,3,6,11,22,33,66 | 35,187 |
Praktikum 4 SDF E (SDF4E)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,188 |
Praktikum 4 SDF F (SDF4F)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,189 |
Praktikum 4 SDF G (SDF4G)
This problem is intended for educational purpose and internal use only. Will be removed after several weeks.
Problems are available
here
. | 35,190 |
Annual leave calculator (ALEAVE)
In a large organisation, people need to keep track of annual leave. Employees will submit their leave requests, and these will be recorded. However, leave requests might overlap.
A leave request has the form
startday endday
where startday and endday represent days of the year, falling between 1 and 366. Start day is the first day of the leave period (so counts as leave). End day is the day the leave ends - that is, the first day back in work.
An employee will make any number of leave requests in a year, which might mistakenly overlap. At the end of the year you will need to calculate the total days leave for an employee based upon their requests.
Requests can come out-of-order.
Input
Input will be the number of leave requests, followed by the set of leave requests, one per line.
Output
Output should be the total days leave requested for the employee in question
Example
Input:
3
140 145
120 123
121 122
Output:
8 | 35,191 |
Getting a rocket off the ground (RCKTFUEL)
In order to get a rocket off the ground, you need to have the right amount of fuel.
This needs to account for the weight of the rocket itself, the weight of the contents, and the weight of the fuel.
For each unit of weight, we require 1/4 as much weight in fuel. Obviously, you then need to account for the weight of the fuel, and the weight of the extra fuel you need to lift the weight of the fuel, and the weight of the extra fuel you need to lift the extra fuel ...
Input
A series of N integers (N < 100), one per line, representing the weight of the rocket, and the weight(s) of the payload(s).
Output
A single integer representing the amount of fuel required to lift the rocket off the ground.
Example
Input:
5
5
Output:
4
Input:
1255
234
12555
45322342
32
Output:
15112140 | 35,192 |
Creating simple acronyms (SIMPACR)
An acronym in its simplest form is made up from the first letter of each word in the name of an organisation, ignoring certain words which function as connective words or conjunctions.
The words which are ignored are:
a, in, is, on, of, and, the, for
Input
The first line contains the number of words making up the full title of the organisation, N. N<100.
After this, the name of the organisation will be presented with one word per line. Words may or may not be capitalised.
Output
The acronym of the organisation, in capital letters.
Example
Input:
5
the
ministry
of
silly
walks
Output:
MSW | 35,193 |
What is the next number in the sequence (ZDIFFSQ2)
Given a sequence of integers [s
1
... s
n
] the first difference of this sequence d
1
is [s
2
-s
1
, s
3
-s
2
, s
4
-s
3
...]. Subsequent differences can be derived from the first difference, so if we number the elements in the first difference [d
11
d
12
d
13
d
14
...] the second difference d
2
is [d
12
-d
11
, d
13
-d
12
, d
14
-d
13
...].
For some sequences, the nth difference is zero.
The triangular numbers can be thought of in this way -
s = [1 3 6 10 15 ...]
d
1
= [2 3 4 5 ...]
d
2
= [1 1 1 1 ...]
d
3
= [0 0 0 0 ...]
Given such a sequence, calculate the next three elements in the sequence.
Input
A single line of text featuring M (M<10) space separated integers
Output
A single line of text featuring 3 space separated integers
Example
Input:
15 32 57 90 131 180
Output:
237 302 375 | 35,194 |
Pizza and pigeons (PZZAPGON)
You're delivering a lot of pizzas in a large city, laid out on a grid, and you have the instructions to get from each address to the next address in the following format:
2N 4W
3S 2E
Assuming you start at 0,0 the above instructions would take you to 1S 2E (or -1,2 assuming negative values for W and S).
At the end of your journey you have to send a message home by pigeon.
How far does the pigeon have to fly? Round up to the nearest integer.
Input
The first line of the input is the number of pizzas to deliver, N. N<100.
The N subsequent lines contain directions from the previous pizza's location to the current pizza's location.
Output
A single number representing the distance that a pigeon would have to fly, to return to the pizza shop (the start of the mission). Round up to the nearest integer.
Example
Input:
3
4W 4N
3E 5S
2W 4N
Output:
5 | 35,195 |
Abundant numbers (ABNDNTNM)
An abundant number has factors that sum to more than itself; thus 12 is abundant as 1 + 2 + 3 + 4 + 6 = 16 > 12; so is 42 as 1 + 2 + 3 + 6 + 7 + 14 + 21 = 54 > 42.
Actually, this is an unusual property; write a program that given integers M and N computes the number of abundant numbers between M and N inclusive.
Input
One line of input featuring two integers M and N. M < N < 2
31
.
Output
A single integer on its own line, representing the count of abundant numbers between M and N.
Example
Input:
204 1007
Output:
201 | 35,196 |
Choosing staff to work on open days (OPNDYSTF)
At university open days, we need to have a certain number of staff available - let's say we need R ambassadors to show people around and greet visitors. There is a pool of N ambassadors that have signed up to work on open days.
On a particular open day, how many possible combinations of R ambassadors can be drawn from a pool of N?
For instance, if we need 2 ambassadors and there are 3 signed up (N=3, R=2) the answer would be 3.
Input
A single line of text with two integers, N and R. R<N<200
Output
A single integer representing the number of possible combinations of ambassadors.
Example
Input:
10 3
Output:
120 | 35,197 |
COMP (IIC12345545)
output the first digit from input
Input
N (1<N<1000)
Output
output first digit
Example
Input:
123
Output:
1 | 35,198 |
Hello world (PRF00)
Input
None. There is no input for this problem.
Output
Hello world! I love C :)
Example
Input:
None
Output:
Hello world! I love C :) | 35,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.