#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int numero;
cin >> numero;
for(int x = 1; x <= numero; x++)
{
double fx = pow(2.71828, 2 * x) - x;
cout << x << ' ' << fx << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a < b) << " " << (c > a) << " " << (a == b) << " " << (a != c) << " " << (c <= b);
}
int A = 100;
int B = 50;
int C = 10;
int a_contador = 0;
int b_contador = 0;
int c_contador = 0;
int a_contador = a_contador + A;
int b_contador = b_contador + B;
int c_contador = c_contador + C;
int a_contador = a_contador + B;
int b_contador = b_contador + A;
int c_contador = c_contador + C;
int a_contador = a_contador + C;
int b_contador = b_contador + B;
int c_contador = c_contador + A;
int a_contador = a_contador + B;
int b_contador = b_contador + C;
int c_contador = c_contador + A;
int a_contador = a_contador + C;
int b_contador = b_contador + A;
int
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int size;
std::cin >> size;
string words[size];
for (int i=0; i<size; i++){
string word;
std::cin >> word;
words[i] = word;
}
int min_word_size = words[0].size();
int min_word_index = 0;
for (int i=1; i<size; i++){
int word_size = words[i].size();
if (word_size < min_word_size){
min_word_size = word_size;
min_word_index = i;
}
}
string min_word = words[min_word_index];
std::cout << min_word << " " << min_word.size() << " ";
if (min_word.size() % 2 == 0){
std::
//Entrada
hola,como,estas
//Salida
aloh,omoc,satse
#include <iostream>
using namespace std;
int main()
{
double x;
cout << "número:";
cin >> x;
if (x > 10) cout << "Es mayor\n";
else cout << "No es mayor\n";
}
def f_graduado(str_calificaciones):
n_aprobadas = sum([ 1 for c in str_calificaciones if c == "A"])
n_calificaciones = len(str_calificaciones)
r_graduado = n_aprobadas/n_calificaciones >= 0.8
return "G" if r_graduado else "F"
print(f_graduado("RARARA"))
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
char palabra[21];
int l;
int menor = 100000000;
char menorPalabra[21];
scanf("%d", &n);
for(int i =0; i<n; i++){
scanf("%s", palabra);
l = strlen(palabra);
if(l < menor){
menor = l;
strcpy(menorPalabra, palabra);
}
}
printf("%s\n%d\n", menorPalabra, menor);
if(menor % 2 == 0){
printf("par");
}else{
printf("impar");
}
return 0;
}
#include <stdio.h>
int main(){
int a, b, c, d, e, menor, mayor;
scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
if (a > b){
mayor = a;
menor = b;
}else{
mayor = b;
menor = a;
}
if (c > mayor){
mayor = c;
}else if(c < menor){
menor = c;
}
if (d > mayor){
mayor = d;
}else if(d < menor){
menor = d;
}
if (e > mayor){
mayor = e;
}else if(e < menor){
menor = e;
}
printf("%d %d\n", menor, mayor);
return 0;
}
#include <iostream>
#include <math.h>
using namespace std;
float f(float x) {
return exp(2*x) - x;
}
int main() {
int n; cin >> n;
for(int x = 1; x <= n; x++) {
cout << x << " " << f(x) << endl;
}
return 0;
}
N = int(input())
count = 0
for i in range(N):
codigo = input()
if len(codigo) >= 2 and codigo[0] == codigo[-1]:
count += 1
print(count)
#include <iostream>
using namespace std;
int main() {
int x,y,z;
cin >> x >> y >> z;
if (x-y < 0) {
cout << "gato B";
}
else if (x-y > 0) {
cout << "gato A";
}
else {
cout << "raton C";
}
return 0;
}
#include <iostream>
using namespace std;
void rotate(int* array, int n, int g){
int aux[n];
for (int i = 0; i < n; i++){
aux[i] = array[i];
}
for (int i = 0; i < n; i++){
if (i < g){
array[i] = aux[n - g + i];
} else {
array[i] = aux[i - g];
}
}
}
int main() {
int n, g;
cin >> n;
cin >> g;
int array[n];
for (int i = 0; i < n; i++){
cin >> array[i];
}
rotate(array, n, g);
for (int i = 0; i < n; i++){
cout << array[i] << " ";
}
}
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
for(int i=1;i<=n;i++){
cout.precision(3);
cout << i << " " << pow(exp(1), 2*i) - i << endl;
}
}
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
float num;
cin >> num;
if (num > 10)
{
cout << "Es mayor";
}
else
{
cout << "No es mayor";
}
return 0;
}
Comparación 1: x ≤ y ≤ z
Comparación 2: x ≤ y o y ≤ z
Comparación 3: x ≥ y o y ≥ z
Comparación 4: x ≠ y
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, median;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
sort(v.begin(), v.end());
if (n % 2 == 0){
median = (v[n/2] + v[n/2 - 1]) / 2;
} else {
median = v[n/2];
}
cout << median << endl;
return 0;
}
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
printf("%d %.3f\n", i, exp(2 * log(i)) - i);
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (abs(a - c) > abs(b - c)) {
cout << "gato B";
} else if (abs(a - c) < abs(b - c)) {
cout << "gato A";
} else {
cout << "raton C";
}
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
int c[5],i;
char a[500];
gets(a);
c[0]=0;c[1]=0;c[2]=0;c[3]=0;c[4]=0;
for(i=0;i<strlen(a);i++)
{
if(a[i]=='a'||a[i]=='A')
{
c[0]++;
}
if(a[i]=='e'||a[i]=='E')
{
c[1]++;
}
if(a[i]=='i'||a[i]=='I')
{
c[2]++;
}
if(a[i]=='o'||a[i]=='O')
{
c[3]++;
}
if(a[i]=='u'||a[i
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for(int i = 0; i < n; ++i) {
cin >> v[i];
}
sort(v.begin(), v.end());
cout << v[n/2] << endl;
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for (int x = 1; x <= n; ++x) {
cout << x << " " << round(pow(2.718281828459, 2*x) - x) << endl;
}
return 0;
}
int main()
{
int N;
cin >> N;
int count = 0;
int first = 0;
int last = 0;
for (int i = 0; i < N; i++)
{
string code;
cin >> code;
first = code[0];
last = code[code.length() - 1];
if (first == last)
{
count++;
}
}
cout << count;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n, g, x[100], y[100];
cin >> n >> g;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
for (int i = 0; i < n; i++) {
y[(i + g) % n] = x[i]; // Giro
}
for (int i = 0; i < n; i++) {
cout << y[i] << ' ';
}
return 0;
}
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
int sum = 0;
while(N--) {
int A;
cin >> A;
sum += A;
}
cout << sum << endl;
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main() {
// your code goes here
string p;
cin >> p;
bool palindromo = true;
for (int i = 0; i < p.length(); i++) {
if (p[i] != p[p.length()-i-1]) {
palindromo = false;
break;
}
}
if (palindromo) {
cout << "SI";
} else {
cout << "NO";
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a < b) << " " << (c > a) << " " << (a == b) << " " << (a != c) << " " << (c <= b) << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int num1, num2;
cout<<"Enter two numbers: ";
cin>>num1>>num2;
cout<<"The sum is: "<<num1+num2;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cin >> n;
cout << pow(n, 2);
return 0;
}
#include<iostream>
using namespace std;
int main() {
int n,m,i;
cin>>n;
cin>>m;
for(i=n;i<=m;i++){
if(i%2==0){
cout<<i<<endl;
}
}
return 0;
}
int main() {
int n;
cin >> n;
int count, max_digit = 10, max_count, digit, pos_count, neg_count;
max_count = -1;
for(int i = 1; i <= 9; i++) {
count = 0;
pos_count = 0;
neg_count = 0;
for(int j = 0; j < n; j++) {
cin >> digit;
if(i == abs(digit)) {
count++;
if(digit > 0)
pos_count++;
else
neg_count++;
}
}
if(count > max_count) {
max_count = count;
max_digit = i;
pos_count = pos_count;
neg_count = neg_count;
}
}
cout << max_digit << " " << pos_count << " " << neg_count;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << boolalpha << (a > b) << " " << (c > a) << " " << (a == b) << " " << (a != c) << " " << (c <= b);
}
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
char frase [500];
int a=0,e=0,i=0,o=0,u=0;
cout<<"ingresar frase: "<<endl;
cin.getline(frase,500);
for(int x=0;x<strlen(frase);x++)
{
if(frase[x]=='a' or frase[x]=='A')
a++;
if(frase[x]=='e' or frase[x]=='E')
e++;
if(frase[x]=='i' or frase[x]=='I')
i++;
if(frase[x]=='o' or frase[x]=='O')
o++;
if(frase[x]=='u' or frase[x]=='U')
u++;
}
cout
void function1(int n){
if( n < 2){
return 0;
}
else{
return 1 + function1(n-1);
}
}
int abs(int a){
return (a < 0) ? -a : a;
}
void solve(int a, int b){
cout << abs(a + b) << endl;
}
#include <iostream>
#include <string>
using namespace std;
int main() {
string line;
getline(cin, line);
// your code here
cout << line;
return 0;
}
#include <iostream>
using namespace std;
int main() {
char animal;
int distancia;
cin >> animal >> distancia;
if(animal != 's'){
cout << "estas a salvo!" << endl;
}
else{
if(distancia >= 10){
cout << "retrocede y busca otro camino" << endl;
}
else{
cout << "corre, corre por tu vida!" << endl;
}
}
return 0;
}
//Ejemplo:
input
3 2 3
output
True True False
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int A, B, R;
cin >> A >> B;
if ((A+B) == 5) {
R = 2*A + B;
} else {
A = A - 1;
if (7*A + B % 2 == 0) {
R = A - B;
}else {
R = A * B;
}
}
cout << R;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << max(a, max(b, c)) << endl;
return 0;
}
int median(vector<int> v){
sort(v.begin(), v.end());
return v[v.size() / 2];
}
int es_mayor_que_diez(int num) {
if (num > 10) {
return true;
} else {
return false;
}
}
#include <iostream>
using namespace std;
int main() {
int a, b;
while (cin>>a>>b) {
if (a + b == 5) {
b += 3;
cout << 2 * a + b << endl;
} else {
a -= 1;
if ((7 * a + b) % 2 == 0)
cout << a - b << endl;
else
cout << a * b << endl;
}
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
string str;
int countVocales[] = {0, 0, 0, 0, 0};
void contarVocales()
{
for (int i = 0; i < str.length(); i++)
{
if (str[i] == 'a')
{
countVocales[0]++;
}
else if (str[i] == 'e')
{
countVocales[1]++;
}
else if (str[i] == 'i')
{
countVocales[2]++;
}
else if (str[i] == 'o')
{
countVocales[3]++;
}
else if (str[i] == 'u')
{
countVocales[4]++;
}
}
}
int main()
{
cin >> str;
contarVocales();
for
#include <iostream>
using namespace std;
int main(){
string s;
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> s;
int l = s.length();
int a=0;
for(int j=0; j<l; j++){
if(s[j] == 'A'){
a++;
}
}
if(a > l/2){
cout << "G" << endl;
}
else{
cout << "F" << endl;
}
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> vect(10, 0);
while (N--) {
char c; int val;
cin >> c >> val;
if (c == '+') {
++vect[val];
} else {
--vect[val];
}
}
int max = -1, max_idx = -1, neg = 0, pos = 0;
for (int i = 0; i < 10; ++i) {
if (vect[i] > max) {
max = vect[i];
max_idx = i;
} else if (vect[i] == max && i < max_idx) {
max_idx = i;
}
}
if (vect[max_idx] > 0) {
pos = vect[max
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, k, i;
cin >> n >> k;
vector<int> prices;
for(int i = 0; i < n; i++)
{
int p;
cin >> p;
prices.push_back(p);
}
int answer = 0;
sort(prices.begin(), prices.end());
for(auto x : prices) {
if (x <= k) {
k -= x;
answer++;
}
}
cout << answer << endl;
return 0;
}
include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
string palabra[n];
for(int i=0;i<n;i++)
{
cin>>palabra[i];
}
int minimo=palabra[0].length();
for(int i=0;i<n;i++)
{
if(minimo==palabra[i].length())
cout << palabra[i] << endl;
else if(minimo>palabra[i].length())
{
minimo = palabra[i].length();
cout << palabra[i] << endl;
}
}
cout << minimo << endl;
if(minimo%2==0)
cout << "par";
else
cout << "non";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[10]{0}, b[10]{0};
for(int i=0; i<n; i++){
int t;
char c;
cin>>c>>t;
a[t]++;
if(c=='+')
b[t]++;
}
int m=0;
for(int i=0; i<10; i++)
if(a[i]>a[m])
m=i;
cout<<m<<endl;
cout<<b[m]<<" "<<a[m]-b[m];
return 0;
}
#include <iostream>
using namespace std;
int main() {
int N, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
cin >> N;
a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
f = 0;
g = 0;
h = 0;
i = 0;
j = 0;
k = 0;
l = 0;
m = 0;
n = 0;
o = 0;
p = 0;
q = 0;
r = 0;
s = 0;
t = 0;
u = 0;
v = 0;
w = 0;
x = 0;
y = 0;
z = 0;
for (int i = 0
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int numero;
double x,f;
cout.precision(3);
cout.setf(ios::fixed);
cin>>numero;
for(int i=1;i<=numero;i++)
{
x=i;
f=pow(2.71828,-x)-x;
cout<<x<<" "<<f<<endl;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,k=0;
cin>>n>>m;
int a[n][m];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
if(a[j][i]==1)
k++;
}
cout<<k<<" ";
k=0;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
if (a + b == 5) {
b = b + 3;
cout << 2*a + b << '\n';
}
else {
a = a - 1;
if (7*a + b % 2 == 0) {
cout << a - b << '\n';
}
else {
cout << a*b << '\n';
}
}
}
int inputSize = int.Parse(Console.ReadLine());
List<int> numbers = new List<int>(inputSize);
for (int i = 0; i < inputSize; i++)
{
numbers.Add(int.Parse(Console.ReadLine()));
}
List<int> results = new List<int>();
for (int i = 0; i < inputSize; i++)
{
if (numbers[i] % 3 == 0)
{
results.Add(i);
}
}
if (results.Count == 0)
{
Console.WriteLine("no hay triples");
}
else
{
Console.WriteLine(results.Count);
foreach (var value in results)
{
Console.Write("{0} ", value);
}
}
#include <iostream>
using namespace std;
int main() {
char palabra[20];
cin >> palabra;
int length = 0;
while (palabra[length] != '\0') {
length++;
}
cout << length;
return 0;
}
int main()
{
int a, b;
cin >> a >> b;
if(a < b)
cout << a;
else
cout << b;
return 0;
}
#include <iostream>
#include <vector>
#include <cmath>
#include <stdio.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v(10);
char c;
int aux;
for(int i = 0; i < n; i++){
cin >> c >> aux;
if(c == '+'){
v[aux]++;
}
else
v[aux]--;
}
int max = 0, num = 1, pos = v[1], neg = abs(v[1]);
for(int i = 2; i < 10; i++){
if(v[i] > max){
num = i;
pos = v[i];
neg = abs(v[i]);
max = v[i];
}
else if(v[i] == max){
if(i < num){
num = i;
pos = v
int add(int x, int y) {
return x + y;
}
int main() {
int a = 1;
int b = 2;
int c = add(a, b);
printf("%d", c);
return 0;
}
#include <iostream>
using namespace std;
int main() {
string resultado;
cin >> resultado;
int aprovados = 0;
int reprobados = 0;
for (int i = 0; i < resultado.size(); i++) {
if (resultado[i] == 'A') {
aprovados++;
} else {
reprobados++;
}
}
if (aprovados > reprobados) {
cout << "G" << endl;
} else {
cout << "F" << endl;
}
return 0;
}
#include <iostream>
#include<string.h>
using namespace std;
int main()
{
char cadena[100];
int longitud=0;
cout<<"Introduce una cadena: ";
cin.getline(cadena,100);
for(int i=0;cadena[i]!='\0';i++)
{
if(cadena[i]!=' ')
{
longitud++;
}
}
cout<<longitud;
return 0;
}
#include <iostream>
using namespace std;
void catandmouse(int a, int b, int c) {
int diff;
if (abs(a-c)>abs(b-c)){
cout<<"gato B";
} else if (abs(a-c)<abs(b-c)){
cout<<"gato A";
} else {
cout<<"raton C";
}
}
int main() {
int q;
cin >> q;
for(int a0 = 0; a0 < q; a0++){
int x;
int y;
int z;
cin >> x >> y >> z;
catandmouse(x, y, z);
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int N, digit, pcount, ncount, max, maxdigit, i, j, k;
while(cin >> N) {
int count[10];
int pos[10];
int neg[10];
for (i = 0; i < 10; i++) {
count[i] = 0;
pos[i] = 0;
neg[i] = 0;
}
for (i = 0; i < N; i++) {
cin >> digit;
if (digit > 0) {
pos[digit]++;
count[digit]++;
}
else {
neg[-digit]++;
count[-digit]++;
}
}
max = 0;
maxdigit = 0;
for (i = 1; i < 10; i++) {
if (count[i] > max) {
max =
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a < b) << " " << (c > a) << " " << (a == b) << " " << (a != c) << " " << (c <= b);
return 0;
}
int main() {
int a, b;
cin >> a >> b;
int diferencia = 0;
if (a >= b) {
diferencia = a - b;
} else {
diferencia = b - a;
}
if (diferencia > 10) {
cout << diferencia << endl;
} else {
cout << "Pocas diferencias" << endl;
}
}
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
int main() {
int n;
std::cin >> n;
std::vector<int> v(n);
std::map<int, int> map_counts;
for (int i = 0; i < n; i++) {
int num;
std::cin >> num;
if (num > 9 || num < -9) {
i--;
continue;
}
v[i] = num < 0 ? num * -1 : num;
map_counts[v[i]]++;
}
int max_num_count = -1;
int max_num = -1;
for (auto kv : map_counts) {
if (max_num_count < kv.second) {
max_num_count = kv.second;
max_num = kv.first;
} else if (max_num_count ==
// usando un if
int a = 3;
int b = 4;
if (a > b) {
cout << a << endl;
} if (a < b) {
cout << b << endl;
} else {
cout << a << endl;
}
// usando un operador ternario
int a = 3;
int b = 4;
(a > b) ? cout << a << endl : cout << b << endl;
N = int(input())
galaxias = [int(galaxias_temp) for galaxias_temp in input().strip().split(' ')]
def comparar(galaxias):
for idx, galaxia in enumerate(galaxias):
for galaxia_compare in galaxias[idx : len(galaxias)]:
print(galaxia_compare)
comparar(galaxias)
#include <iostream>
#include <string>
using namespace std;
int main() {
string calificaciones;
getline(cin, calificaciones);
double aprobados = 0;
double reprobados = 0;
for(char calificacion : calificaciones) {
if(calificacion == 'A') {
aprobados++;
} else {
reprobados++;
}
}
double porcentaje_aprobados = (aprobados / (aprobados + reprobados)) * 100;
if(porcentaje_aprobados > 80) {
cout << "G" << endl;
} else {
cout << "F" << endl;
}
}
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
// Escribe el codigo aqui para resolver el problema
return 0;
}
#include <iostream>
using namespace std;
int main() {
int A,B;
cin>>A>>B;
if (A+B==5){
B += 3;
cout<<2*A + B;
}
else{
A -= 1;
if((7*A + B) % 2 == 0){
cout<< A - B;
}
else{
cout<<A*B;
}
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
string palabras[100];
string menor = "";
int cuantos;
int min = 100;
cin >> n;
for ( int i=0; i<n; i++) {
cin >> palabras[i];
cuantos = palabras[i].size();
if ( cuantos < min) {
min = cuantos;
menor = palabras[i];
}
}
cout << menor << endl;
cout << min << endl;
if ( min % 2 == 0) {
cout << "Par" << endl;
}
else {
cout << "Impar" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
//Funciones
int main() {
//Variables
int N;
cin >> N;
int arr[N];
int arrC[9];
int arrP[9];
int max;
int pos;
//Input
for (int i = 0; i < N; i++) {
cin >> arr[i];
arr[i] = abs(arr[i]);
}
//Logica
for (int i = 0; i < 9; i++) {
arrC[i] = 0;
arrP[i] = 0;
}
for (int i = 0; i < N; i++) {
arrC[arr[i] - 1]++;
if (arr[i] > 0) {
arrP[arr[i] - 1]++;
}
}
max = arrC[0];
pos = 0;
for (int i = 0;
#include <iostream>
using namespace std;
int main()
{
int L;
cin>>L;
if(L >= 0 && L <= 3)
cout<<"BEBE";
else if(L >= 4 && L <= 14)
cout<<"NINO";
else if(L >= 15 && L <= 18)
cout<<"JOVEN";
else if(L >= 19 && L <= 65)
cout<<"ADULTO";
else if(L >= 66)
cout<<"ADULTO 3RA";
return 0;
}
def add(a, b):
return a + b
add(1, 2)
def fun(a, b):
if (a > 0 and b > 0):
return a + b
elif (a > 0 and b < 0):
return a - b
elif (a < 0 and b > 0):
return a + b
else:
return a - b
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n,median=0;
cin>>n;
vector<int>v(n);
for(int i=0;i<n;i++)
cin>>v[i];
sort(v.begin(),v.end());
if(v.size()%2==0)
median=(v[(v.size()-1)/2]+v[v.size()/2])/2;
else
median=v[v.size()/2];
cout<<median<<endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
if (a+b==5) c = 2*a+b;
else c = (a-1);
c = 7*a+b;
if (c%2==0) c = a-b;
else c = a*b;
cout << c;
return 0;
}
n = int(input())
l = list(map(int, input().split()))
l.sort()
print(l[int(n/2)])
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cin >> n;
string s;
cin >> s;
int non_space = 0;
for (int i = 0; i < n; i++)
{
if (s[i] != ' ')
{
non_space++;
}
}
cout << non_space << endl;
return 0;
}
#include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
map<string,int> dic;
string str;
for(int i=0;i<n;i++){
cin>>str;
dic[str]+=1;
}
int max_value = 0;
string max_key;
int min=10;
int cont_min=0;
for (std::map<string,int>::iterator it=dic.begin(); it!=dic.end(); ++it){
//cout << it->first << "=>" << it->second << '\n';
if(it->second > max_value){
max_value=it->second;
max_key=it->first;
}
if(it->first[0]=='-'){
cont_min+=it->second;
}
if(it->
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int nums[n];
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
int k;
cin >> k;
for (int i = 0; i < n; i++) {
if (nums[i] % k != 0) {
printf("X ");
} else {
printf("%d ", nums[i]);
}
}
printf("\n");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main(){
int N;
int cont=0;
scanf("%d", &N);
char *cadena = malloc(sizeof(char)*N);
for(int i=0; i<N; i++){
scanf("%s", cadena);
if(cadena[0]==cadena[strlen(cadena)-1] && strlen(cadena)>1)
cont++;
}
printf("%d\n", cont);
free(cadena);
return 0;
}
include <iostream>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
int suma = a + b;
int absoluto = 0;
if(suma >= 0){
absoluto = suma;
} else {
absoluto = -suma;
}
cout << absoluto << endl;
return 0;
}
Entrada Salida
AAAAAAAA G
ARRAARRAR F
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, const char * argv[]) {
int n;
cin >> n;
double sum = 0;
int x = 1;
while (x <= n) {
sum = exp(2 * x) - x;
cout << x << " " << sum << endl;
x++;
}
return 0;
}
#include<iostream>
using namespace std;
int main(){
int a, b, c, d, e, f, g;
cin >> a >> b >> c >> d >> e;
f = min(a, min(b, min(c, min(d, e))));
g = max(a, max(b, max(c, max(d, e))));
cout << f << " " << g;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n*n << endl;
}
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
// function that: calculed the median of a sort vector
int get_median(vector<int> &L) {
int n = L.size();
if (n % 2 == 1) {
return L[n / 2];
} else {
return (L[n / 2 - 1] + L[n / 2]) / 2;
}
}
// function that: main function
int main() {
vector<int> L;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
L.push_back(tmp);
}
sort(L.begin(), L.end());
cout << get_median(L) << endl;
return 0;
}
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef vector<int> vi;
typedef set<int> si;
int main(int argc, char* argv[])
{
int N;
while (cin>>N) {
int sum = 0;
map<int,int> nums;
for (int i=0;i<N;++i) {
int n; cin>>n;
sum += n;
#include <iostream>
using namespace std;
int main()
{
int n;
if(cin >> n)
{
int x;
cin >> x;
int count = 1;
if(n % 2)
{
while(cin >> x && count < n / 2 + 1)
count++;
cout << x << endl;
}
else
{
while(cin >> x && count < n / 2)
{
count++;
}
int y = x;
if(cin >> x)
{
cout << (x + y) / 2 << endl;
}
else
{
cout << y << endl;
}
}
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int counter[10];
int counterp[10];
int countern[10];
for (int i = 0; i < 10; i++) {
counter[i] = 0;
counterp[i] = 0;
countern[i] = 0;
}
for (int i = 0; i < n; i++) {
char c;
cin >> c;
if (c == '+') {
char c2;
cin >> c2;
counter[c2 - '0']++;
counterp[c2 - '0']++;
} else if (c == '-') {
char c2;
cin >> c2;
counter[c2 - '0']++;
countern[c2 - '0']++;
}
}
int more = 0;
int pos = 0;
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[])
{
int n;
scanf("%d",&n);
char palabras[n][50];
char menor[50];
int menor_cant = 50;
for (int i = 0; i < n; ++i)
{
scanf("%s",&palabras[i]);
}
for (int i = 0; i < n; ++i)
{
int cant = strlen(palabras[i]);
if(cant<menor_cant)
{
menor_cant = cant;
strcpy(menor,palabras[i]);
}
}
printf("%s\n",menor);
printf("%d\n",menor_cant);
if (menor_cant%2==0
#include <stdio.h>
int main()
{
char cad[500];
int i, cant[5];
scanf("%s", cad);
for(i = 0; i < 5; i++) cant[i] = 0;
for(i = 0; cad[i] != '\0'; i++)
{
switch(cad[i])
{
case'a':
case'A':cant[0]++;break;
case'e':
case'E':cant[1]++;break;
case'i':
case'I':cant[2]++;break;
case'o':
case'O':cant[3]++;break;
case'u':
case'U':cant[4]++;break;
}
}
for(i = 0; i < 5; i++) printf("%d ", cant[i]);
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin>>a>>b>>c;
cout << a < b << " ";
cout << c > a << " ";
cout << a == b << " ";
cout << a != c << " ";
cout << c <= b << endl;
return 0;
}
#include <stdio.h>
#include <math.h>
int main()
{
int n, x;
double f;
scanf("%d", &n);
for(x=1; x<=n; x++)
{
f = pow(2.71828, 2*x)-x;
printf("%d %.3f\n", x, f);
}
return 0;
}
long long int l, p, veces=0, i;
string palabra;
cin>>palabra;
cin>>l;
p = palabra.size();
for(i=0; i<p; i++){
if(palabra[i]==l){
veces++;
}
}
cout<<veces<<endl;
if(a>10) cout<<"es mayor";
else cout<<"no es mayor";
#include <iostream>
using namespace std;
int main() {
string grades;
int approved;
cin >> grades;
approved = 0;
for (int i = 0; i < grades.length(); i++) {
if (grades[i] == 'A') {
approved = approved + 1;
}
}
if (approved >= (grades.length() * 0.8)) {
cout << "G" << endl;
} else {
cout << "F" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n;
cin >> k;
int num;
int cant = 0;
for (int i = 0; i < n; i++) {
cin >> num;
if (num % k == 0) {
cant++;
}
}
cout << cant << endl;
}
(x < y)
(y < z)
(x < z)
if (x < y < z)
if (x <= y <= z)
if (x == y)
if (x != y)
if (x >= y >= z)
if (x > y > z)
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
int c = a + b;
if(c == 5) {
cout << 2 * a + b << endl;
} else {
c = a - b;
if(c == 7) {
cout << a - b << endl;
} else {
cout << a * b << endl;
}
}
return 0;
}
#include <iostream>
using namespace std;
int main(){
int n, jump = 1;
cin >> n;
while(jump <= n){
cout << jump << endl;
jump++;
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
string menor = "";
string palabra;
int n, cantidad;
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> palabra;
if(menor.size() == 0 || palabra.size() < menor.size())
menor = palabra;
}
cout << menor << endl;
cout << menor.size() << endl;
cantidad = menor.size();
if(cantidad % 2 == 0)
cout << "Par";
else
cout << "Impar";
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int n, k, a[100];
cin >> n;
for(int i=0; i<n;i++)
{
cin >> a[i];
}
cin >> k;
for(int i=k; i<n; i++)
{
cout << a[i] << " ";
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
string word;
int n;
string shortWord;
cin >> word;
cin >> n;
shortWord = word.substr(0, n) + word.substr(word.length() - n);
cout << shortWord << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int N, K;
int cont = 0;
cin >> N;
cin >> K;
int num[N];
for(int i = 0; i < N; i++){
cin >> num[i];
}
for(int i = 0; i < N; i++){
if(num[i] % K == 0){
cont++;
}
}
cout << cont;
return 0;
}
/* Autor: Daniel Caballero
* Version: 1.0
* Fecha de creacion: 01 de Septiembre de 2020
* Fecha de modificacion:
* Descripcion: Programa para mostrar el mayor de dos números
*/
#include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Escribe dos numeros enteros: ";
cin >> a >> b;
if (a > b)
{
cout << "El mayor es: " << a << endl;
}
else if (b > a)
{
cout << "El mayor es: " << b << endl;
}
else
{
cout << "El numero mayor es: " << a << endl;
}
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main() {
string cadena;
int aprobadas = 0, reprobadas = 0;
cin >> cadena;
for(int i = 0; i < cadena.length(); i++) {
if (cadena[i] == 'A') {
aprobadas++;
} else if (cadena[i] == 'R') {
reprobadas++;
}
}
if (aprobadas > reprobadas) {
cout << "G" << endl;
} else {
cout << "F" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
//include <iostream>
//#include <algorithm>
//using namespace std;
//
//int main()
//{
// int nums[100];
// int n;
// cin >> n;
// for (int i = 0; i < n; i++)
// cin >> nums[i];
// sort(nums, nums + n);
// int count = 0;
// int pos[100];
// for (int i = 0; i < n; i++)
// if (nums[i] % 3 == 0)
// pos[count++] = i + 1;
// if (count == 0)
// cout << "no hay triples" << endl;
// else
// {
// cout << count << endl;
// for (int i = 0; i < count; i++)
// cout << pos[i] << ' ';
// }
// return 0;
//}
#include <iostream>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
if((a+b)==5)
cout<<2*a*b<<endl;
if((a+b)!=5)
cout<<a-b<<endl;
if((7*a+b)%2==0)
cout<<a-b<<endl;
if((7*a+b)%2!=0)
cout<<a*b<<endl;
return 0;
}
int main() {
int a, b;
cin >> a >> b;
if (a > 10) {
cout << a << " es mayor que 10" << endl;
}
else {
cout << a << " es menor que 10" << endl;
}
if (b > 10) {
cout << b << " es mayor que 10" << endl;
}
else {
cout << b << " es menor que 10" << endl;
}
}
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> v1(n);
vector<int> v2(n);
for (int i = 0; i < n; ++i)
{
cin>>v1[i];
}
for (int i = 0; i < n; ++i)
{
cin>>v2[i];
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
bool result = true;
for (size_t i = 0; i < v1.size(); i++)
{
if(v1[i]<=v2[i]){
result = false;
break;
}
}
cout<<result<<endl;
return 0;
}
#include <cmath>
#include <iomanip>
#include <iostream>
int main(int argc, char const *argv[])
{
int n;
std::cin >> n;
for (int i = 1; i <= n; i++)
{
double x = i;
double fx = std::pow(M_E, 2 * x) - x;
std::cout << std::fixed << std::setprecision(3) << x << " " << fx << std::endl;
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int n;
cin >> n;
for(int x=1; x<=n; x++){
float result = (pow(exp(1),2*x) - x);
cout << x << " ";
cout << fixed << setprecision(3) << result << endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i];
}
sort(v.begin(), v.end());
cout << v[n / 2] << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int T, N;
cin >> T;
cin >> N;
int songs[N];
for (int i=0; i<N; i++) {
cin >> songs[i];
}
int total_time = 0;
for (int i=0; i<N; i++) {
total_time += songs[i];
}
if (total_time == T) {
cout << "Es exacto" << endl;
} else if (total_time < T) {
cout << "Es posible" << endl;
} else {
cout << "No es posible" << endl;
}
return 0;
}
#include <iostream>
#include <string.h>
using namespace std;
int main() {
char str[1001];
cin.getline(str, 1001);
int len = strlen(str);
int i = 0;
int start = 0;
int end = 0;
for (; i <= len; i++) {
if (str[i] == ',' || str[i] == '\0') {
end = i - 1;
for (int j = end; j >= start; j--) {
cout << str[j];
}
start = end + 2;
if (str[i] != '\0') {
cout << ',';
}
}
}
cout << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if(a < b) {
cout << "True ";
} else {
cout << "False ";
}
if(c > a) {
cout << "True ";
} else {
cout << "False ";
}
if(a == b) {
cout << "True ";
} else {
cout << "False ";
}
if(a != c) {
cout << "True ";
} else {
cout << "False ";
}
if(c <= b) {
cout << "True ";
} else {
cout << "False ";
}
return 0;
}
#include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
if(a+b == 5){
std::cout << a * 3 + b << std::endl;
}else{
std::cout << 1 - a << std::endl;
}
if(a + b % 2 == 0){
std::cout << a - b << std::endl;
}else{
std::cout << a * b << std::endl;
}
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
double f(double x){
return exp(2*x) - x;
}
int main(){
int n;
double x;
cin >> n;
for (int i = 1; i <= n; i++){
x = i;
printf("%.3f %.3f\n", x, f(x));
}
}
#include <iostream>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
bool condition = a + b == 5;
if(condition){
b += 3;
cout << a * 2 + b << endl;
}
else{
a -= 1;
if(condition){
a -= 1;
}
if(7 * a + b % 2 == 0){
cout << a - b << endl;
}
else{
cout << a * b << endl;
}
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cout << fixed << setprecision(3) << i << " " << pow(n, 2*i) - i << "\n";
}
return 0;
}
if (x > y and x > z) {
cout << "True ";
} else {
cout << "False ";
}
if (y > z) {
cout << "True ";
} else {
cout << "False ";
}
def mayor_menor(n):
if n > 10:
return "El número " + str(n) + " es mayor a 10"
elif n < 10:
return "El número " + str(n) + " es menor a 10"
else:
return "El número " + str(n) + " es igual a 10"
int comparar(int numero_de_galaxias_1, int numero_de_galaxias_2, int numero_de_galaxias_3) {
int resultado;
resultado = numero_de_galaxias_1;
if (numero_de_galaxias_2 > resultado) {
resultado = numero_de_galaxias_2;
}
if (numero_de_galaxias_3 > resultado) {
resultado = numero_de_galaxias_3;
}
return resultado;
}
x<y<z
x>y>z
x>y<z
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
int n;
cin >> n;
for (int x = 1; x <= n; x++) {
double fx = exp(2 * x) - x;
cout << x << " " << fixed << setprecision(3) << fx << endl;
}
return 0;
}
#include<iostream>
#include<string>
using namespace std;
int main()
{
int num;
string min = "";
cin>>num;
min.reserve(num);
getline(cin,min);
for(int i = 0; i < num ; i++)
{
getline(cin,min);
}
cout<<min<<endl;
cout<<min.size()<<endl;
if(min.size()%2 == 0)
{
cout<<"Par";
}
else
{
cout<<"Impar";
}
return 0;
}
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string cad;
int cont[5];
for(int i = 0; i < 5; i++) cont[i] = 0;
getline(cin, cad);
for(int i = 0; i < cad.size(); i++){
switch(tolower(cad[i])){
case 'a':
cont[0]++;
break;
case 'e':
cont[1]++;
break;
case 'i':
cont[2]++;
break;
case 'o':
cont[3]++;
break;
case 'u':
cont[4]++;
break;
}
}
for(int i = 0; i < 5; i++) cout << cont[i] << " ";
return 0;
}
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int *arr = new int[N];
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
int X;
cin >> X;
int count = 0;
for (int i = 0; i < N; i++) {
if (X == arr[i]) {
count++;
}
}
cout << count << endl;
return 0;
}
4
2
4
1
3
#include <iostream>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b;
if (a+b == 5) cout << 2*a+b << endl;
else cout << a-1 << endl;
return 0;
}
/* Introduce your code here. */
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n,g;
cin>>n>>g;
vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
for(int i=0;i<n;i++){
cout<<v[(i+g)%n]<<" ";
}
}
#include <iostream>
using namespace std;
int main() {
string s;
int a = 0, e = 0, i = 0, o = 0, u = 0;
getline(cin, s);
for (int j = 0; j < s.size(); ++j) {
if (s[j] == 'a' || s[j] == 'A') a++;
else if (s[j] == 'e' || s[j] == 'E') e++;
else if (s[j] == 'i' || s[j] == 'I') i++;
else if (s[j] == 'o' || s[j] == 'O') o++;
else if (s[j] == 'u' || s[j] == 'U') u++;
}
cout << a << " " << e << " " << i << " " << o << " " << u << endl;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
string word;
char letter;
int count = 0;
cin >> word;
cin >> letter;
for (int i = 0; i < word.length(); i++)
{
if (letter == word[i])
{
count++;
}
}
cout << count << endl;
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char* argv[]) {
int n,x;
scanf("%d",&n);
printf("%d",n);
for(x=0; x<=n; x++){
printf("\n%d %.3f",x,exp(2*x)-x);
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a < b) << " " << (c > a) << " " << (a == b) << " " << (a != c) << " " << (c <= b) << endl;
}
#include<iostream>
using namespace std;
int main()
{
int N, C = 0;
string a;
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> a;
if(a[0] == a[a.size() - 1])
C ++;
}
cout << C << endl;
return 0;
}
#include <iostream>
#include <cmath>
int main(){
int n;
std::cin >> n;
for(int x = 1; x <= n; x++){
double f = std::exp(2*x) - x;
std::cout << x << " " << f << std::endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main(){
int A, B, C;
cin >> A;
cin >> B;
if (A+B == 5)
{
B += 3;
C = 2*A + B;
}
else
{
A -= 1;
if (7*A+B % 2 == 0)
C = A-B;
else
C = A*B;
}
cout << C << endl;
return 0;
}
int count_galaxies(int region)
{
return rand() % 10 + 1;
}
>>> entrada = "ARARA"
>>> computador(entrada)
F
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << max3(max3(a, b), c);
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a = 1;
for(int i=0; i<n; i++){
cout<<a<<" ";
a+=4*(i+1);
}
cout<<endl;
}
#include <iostream>
using namespace std;
int main() {
int A,B;
cin >> A >> B;
if(A+B==5){
B=B+3;
cout << 2*A+B;
}
else if(A+B!=5){
A=A-1;
cout << A+B;
}
if(7*A+B%2==0){
cout << A-B;
}
else if(7*A+B%2!=0){
cout << A*B;
}
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main () {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cout << i << " " << pow(M_E, 2 * i) - i << endl;
}
return 0;
}
#include <cmath>
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i = 1; i<=n; i++){
printf("%.3f %.3f \n", i, pow(M_E,2*i)-i);
}
}
#include <iostream>
using namespace std;
// Variable global
int num_galaxias = 5;
// Funciones
int region_uno(int num_galaxias){
return num_galaxias*2;
}
int region_dos(int num_galaxias){
return num_galaxias+1;
}
int region_tres(int num_galaxias){
return num_galaxias*4;
}
int main(){
cout<<"El número de galaxias en la región uno es: "<<region_uno(num_galaxias)<<endl;
cout<<"El número de galaxias en la región dos es: "<<region_dos(num_galaxias)<<endl;
cout<<"El número de galaxias en la región tres es: "<<region_tres(num_galaxias)<<endl;
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
v.push_back(x);
}
// your code goes here
return 0;
}
#include<iostream>
using namespace std;
int Sumar(int a, int b){
return a+b;
}
int main(){
cout << "La suma de 2 y 3 es: " << Sumar(2,3) << endl;
system("pause");
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int num, contador = 0, max_contador = 0, num_max;
for(int i = 0; i < n; i++){
cin >> num;
if(num > 0){
num = num * -1;
}
else {
num = num * -1;
}
for(int j = 0; j < n; j++){
int aux;
cin >> aux;
if(num == aux)
contador++;
}
if(contador > max_contador){
max_contador = contador;
num_max = num;
}
else if (contador == max_contador){
if(num > num_max){
num_max = num;
}
}
}
cout << num_max * -1 << " " << max_contador
#include <iostream>
using namespace std;
int main() {
string data;
cin >> data;
int aproved = 0;
int reprobate = 0;
for (int i = 0; i < data.length(); ++i) {
if (data[i] == 'A') {
aproved++;
} else {
reprobate++;
}
}
if (aproved > (data.length()*0.8)) {
cout << "G";
} else {
cout << "F";
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int A, B, C, x = 0;
cin >> A >> B >> C;
if (C - A > C - B)
{
cout << "gato B" << endl;
}
else if (C - A < C - B)
{
cout << "gato A" << endl;
}
else
cout << "raton C" << endl;
}
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << (a < b) << " ";
cout << (c > a) << " ";
cout << (a == b) << " ";
cout << (a != c) << " ";
cout << (c <= b);
return 0;
}
int median(vector<int> v) {
int n = v.size();
int m = n / 2;
return n % 2 == 0 ? (v[m-1] + v[m]) / 2 : v[m];
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
sort(v.begin(), v.end());
cout << v[n/2] << endl;
return 0;
}
#include <iostream>
using namespace std;
int main(){
// Define variables
int a, b;
// Capture inputs
cin >> a >> b;
// Print result
cout << abs(a + b);
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> array(n);
for (int i = 0; i < n; i++) {
cin >> array[i];
}
std::sort(array.begin(), array.end());
int half = n / 2;
if (n % 2 == 0)
cout << (array[half - 1] + array[half]) / 2;
else
cout << array[half];
return 0;
}
def desemparate(numero):
if numero > 10:
return "mayor que 10"
else:
return "menor que 10"
//Este programa pide un numero y le dice al usuario si ese numero es mayor o menor a 10.
#include <iostream>
using namespace std;
int main(){
int numero;
cout<<"Ingrese un numero entero: ";
cin>>numero;
if(numero>10){
cout<<"El numero es mayor a 10";
}
else{
cout<<"El numero es menor a 10";
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n; cin>>n;
ll sum=0;
for(int i=1; i<=n; i++){
sum+= i*i;
}
cout<<sum<<endl;
}
def ocurrencias(cad):
vocales = ['a', 'e', 'i', 'o', 'u']
contadores = [0, 0, 0, 0, 0]
for c in cad.lower():
if c in vocales:
contadores[vocales.index(c)] += 1
return contadores
cad = input()
contadores = ocurrencias(cad)
print("{} {} {} {} {}".format(*contadores))
#include <iostream>
#include <string>
#define MAX 500
using namespace std;
int main(void) {
int conta = 0, conte = 0, conti = 0, conto = 0, contu = 0;
char cadena[MAX];
cin.getline(cadena,MAX);
for(int i = 0; i < MAX; i++){
switch(cadena[i]){
case 'a':
case 'A':
conta++;
break;
case 'e':
case 'E':
conte++;
break;
case 'i':
case 'I':
conti++;
break;
case 'o':
case 'O':
conto++;
break;
case 'u':
case '
#include <cmath>
#include <cstdio>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
printf("%d %.3e\n", i, exp(2 * i) - i);
}
return 0;
}
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++){
cin >> v[i];
}
vector<int> triples;
for (int i = 0; i < n; i++){
if(v[i] % 3 == 0)
triples.push_back(i + 1);
}
if(triples.size() == 0)
cout << "no hay triples" << endl;
else {
cout << triples.size() << endl;
for (int i = 0; i < triples.size(); i++){
cout << triples[i] << " ";
}
cout << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int N, i, j;
cin >> N;
int arr[N];
for (i = 0; i < N; i++) {
cin >> arr[i];
}
j = N-1;
for (i = 0; i < N/2; i++) {
cout << arr[i] + arr[j] << " ";
j -= 1;
}
return 0;
}
#include <iostream>
#include <string.h>
using namespace std;
int main(){
string cadena;
int a, e, i, o, u;
cin >> cadena;
a = e = i = o = u = 0;
int largo = cadena.size();
for (int i = 0; i < largo; i++){
switch (cadena[i]) {
case 'a':
case 'A':
a++;
break;
case 'e':
case 'E':
e++;
break;
case 'i':
case 'I':
i++;
break;
case 'o':
case 'O':
o++;
break;
case 'u':
case 'U':
u++;
break;
}
}
cout << a << " " << e << " " << i << " " << o << " " << u << end
#include <iostream>
#include <vector>
using namespace std;
int main() {
int weapon_amt;
cin >> weapon_amt;
vector<int> weapons;
int temp;
for (int i = 0; i < weapon_amt; i++) {
cin >> temp;
weapons.push_back(temp);
}
int max_weapon = 0;
for (int i = 1; i < weapons.size(); i++) {
if (weapons[i] > weapons[max_weapon]) {
max_weapon = i;
}
}
cout << weapons[max_weapon] << " " << max_weapon + 1 << endl;
return 0;
}
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int x=1;x<=n;x++){
float f = exp(2*x) - x;
cout<<x<<" "<<f<<endl;
}
return 0;
}
//Declaración
int region1;
int region2;
int region3;
Entrada
hola,mundo,estoy,aqui
Salida
aloh,odnum,oyts,iaq
def ejercicio3(a, b):
if a > b:
return a
else:
return b
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
int p;
int count = 0;
cin >> n;
int arr[n];
for (int i = 0; i < n; ++i)
{
cin >> arr[i];
}
cin >> p;
for (int i = 0; i < n; ++i)
{
if (p == 0)
{
if (arr[i] % 2 == 0)
{
if (count == 0)
{
cout << arr[i];
count++;
}
else
cout << " " << arr[i];
}
}
else if (p == 1)
{
if (arr[
#include <iostream>
#include <math.h> /* pow */
using namespace std;
int main(){
int x, n;
float fx;
cin >> n;
x = 0;
while (x <= n){
fx = pow(2.71828,2*x)-x;
cout << x << " " << fx << endl;
x++;
}
return 0;
}
int main() {
int a, b;
cin >> a >> b;
if (a + b == 5) {
cout << a * b + 3;
} else if (a - 1 == 0) {
cout << 2 * a + b;
} else if (7 * a + b % 2 == 0) {
cout << a - b;
} else {
cout << a * b;
}
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
double x = i;
double fx = pow(M_E, 2*x) - x;
printf("%.3f %.3f\n",x, fx);
}
}
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
string result;
cin >> result;
int count = 0;
int size = result.size();
for (int i = 0; i < n; i++) {
if (result[i] == 'A') {
count++;
}
}
if (count >= (4 * (n / 5))) {
cout << "G";
} else {
cout << "F";
}
return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
int n;
double x, fx;
scanf("%d", &n);
for(int i = 1; i <= n; i++){
x = (double)i;
fx = exp(2 * x) - x;
printf("%0.3lf %0.3lf\n", x, fx);
}
return 0;
}
x < y and x < z
x < y and x > z
x > y and x < z
x > y and x > z
int median(List L) {
int n = L.size();
int ans = 0;
if (n == 1) {
ans = L[0];
}
else if (n % 2 == 0) {
ans = (L[n/2] + L[n/2 - 1])/2;
}
else {
ans = L[n/2];
}
return ans;
}
>>> entrada = "AAARAA"
>>> print(sebas_se_gradua(entrada))
G
>>> entrada = "ARAARAA"
>>> print(sebas_se_gradua(entrada))
F
#include <iostream>
using namespace std;
int main(){
int x, y, z;
cin >> x >> y >> z;
if(x == y && y == z)
cout << "equilatero" << endl;
else if(x == y || x == z || y == z)
cout << "isosceles" << endl;
else
cout << "escaleno" << endl;
return 0;
}
def sol(a, b):
if a < b:
return b * 2
if a > b:
return (a + b) * 2
if a == b:
return a * a
#include <iostream>
using namespace std;
unsigned long long int pow(int a, int b){
unsigned long long int res = 1;
while(b--) res*=a;
return res;
}
int main(){
int a, b;
cin >> a >> b;
cout << pow(a, b) << endl;
return 0;
}
#include <iostream>
int main() {
/*
Si la condición se cumple imprime
true en caso contrario imprime
false
*/
int a, b, c;
std::cin >> a >> b >> c;
std::cout << (a < b) << " "
<< (c > a) << " "
<< (a == b) << " "
<< (a != c) << " "
<< (c <= b) << std::endl;
return 0;
}
// triple.cpp: Juan C. Medina
// Description: Multiples of 3
#include <iostream>
#include <vector>
using namespace std;
vector<int> findTriples(vector<int> v){
vector<int> locs;
for(auto i = 0; i < v.size(); i++){
if(v[i] % 3 == 0){
locs.push_back(i);
}
}
return locs;
}
int main() {
int n;
cin >> n;
vector<int> v;
for(auto i = 0; i < n; i++){
int temp;
cin >> temp;
v.push_back(temp);
}
vector<int> locs = findTriples(v);
if(locs.size() == 0){
cout << "no hay triples." << endl;
}else{
cout << locs.size() << endl;
for(
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
cout << i << " " << fixed << setprecision(3) << pow(M_E, 2 * i) - i << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
int a[100];
int b[100];
int sum = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
for (int i = 0; i < n; i++) {
sum += a[i] * b[i];
}
cout << sum;
return 0;
}
#include <iostream>
#include <cmath>
double f(int n){
return exp(2*n)-n;
}
int main() {
int n;
std::cin >> n;
for(int i=1; i<=n; i++)
std::cout << i << " " << f(i) << '\n';
}
#include <iostream>
using namespace std;
int A, B;
int main(){
cin >> A >> B;
if (A > B){
cout << "A\n";
return 0;
}else if (B > A){
cout << "B\n";
return 0;
}
cout << "0\n";
}
#include <iostream>
#include <vector>
using namespace std;
int main(){
int tiempo_sala, num_canciones;
cin >> tiempo_sala;
cin >> num_canciones;
vector<int> canciones;
int tiempo_cancion;
for(int i=0;i<num_canciones;i++){
cin >> tiempo_cancion;
canciones.push_back(tiempo_cancion);
}
int tiempo_total=0;
for(int i=0;i<num_canciones;i++){
tiempo_total+=canciones[i];
}
if(tiempo_sala>=tiempo_total){
cout << "Es posible"<<endl;
}
else{
cout << "No es posible"
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N, num;
cin >> N;
vector<int> v(N);
unordered_map<int, int> mapa;
for (int i = 0; i < N; i++) {
cin >> num;
v[i] = abs(num);
mapa[abs(num)] += 1;
}
auto maxNum = *max_element(mapa.begin(), mapa.end(),
[](const pair<int, int>& p1, const pair<int, int>& p2) {
return p1.second < p2.second;
});
int ans = maxNum.first;
int apariciones = maxNum.second;
int positivas = 0, negativas = 0;
for (int i = 0; i < N; i++) {
if (v[i] == ans) {
if (v
#include <iostream>
using namespace std;
int main () {
int P, Q;
cin >> P >> Q;
if (P*P*P + Q*Q*Q*Q - 2*P*P < 680) {
cout << P << endl << Q << endl;
}
}
N = int(input())
array = list(map(int, input().split()))
array_triples = []
for i in range(N):
if array[i] % 3 == 0:
array_triples.append(i)
if len(array_triples) == 0:
print('no hay triples')
else:
print(len(array_triples))
for j in array_triples:
print(j, end=' ')
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a > b) {
a = a * 2;
} else {
a = a + 1;
}
if (a < b) {
b = b - 1;
} else {
b = b * 2;
}
cout << a + b << endl;
return 0;
}
int main()
{
int A, B, C;
cin >> A >> B >> C;
if (A == C)
cout << "raton C";
else if (A > B)
cout << "gato B";
else
cout << "gato A";
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main() {
string a;
int count[5];
for(int i = 0; i<5; i++){
count[i]=0;
}
cin >> a;
for(int i = 0; i<a.length(); i++){
if(a[i] == 'a'){
count[0]++;
}
else if(a[i] == 'e'){
count[1]++;
}
else if(a[i] == 'i'){
count[2]++;
}
else if(a[i] == 'o'){
count[3]++;
}
else if(a[i] == 'u'){
count[4]++;
}
}
for(int i = 0; i<5; i++){
cout << count[i] << endl;
}
return 0
if(A > B) {
return A
} else {
return B
}
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
cout << v[n/2] << endl;
return 0;
}
# include <iostream>
using namespace std;
int main(){
int A, B
cout << "Ingrese el valor de A: ";
cin >> A;
cout << "Ingrese el valor de B: ";
cin >> B;
if (A > B){
cout << "A es mayor que B";
}
if (A < B){
cout << "B es mayor que A";
}
if (A == B) {
cout << "A es igual a B";
}
}
def conditional(a, b):
if a > b:
return a
else:
return b
conditional(2, 3)
if (A + B == 5) {
B += 3;
print(2*A + B);
} else {
A -= 1;
if (7*A + B % 2 == 0) {
print(A - B);
} else {
print(A*B);
}
}
#include <stdio.h>
int main()
{
char p[10];
int i, j, pal=0;
printf("Introduzca una palabra: ");
scanf("%s", p);
for (i=0, j=strlen(p)-1; i<strlen(p); i++, j--) {
if (p[i]==p[j]) {
pal++;
}
}
if (pal==strlen(p)) {
printf("La palabra es palindroma.\n");
}
else {
printf("La palabra no es palindroma.\n");
}
}
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n, x;
cin >> n;
for(int i = 1; i <= n; ++i) {
x = i;
cout << x << " " << sqrt(x) << endl;
}
return 0;
}
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int b[n];
for (int i = 0; i < n; i++) {
cin >> b[i];
}
int mult = 0;
for (int i = 0; i < n; i++) {
mult += a[i] * b[i];
}
cout << mult << endl;
return 0;
}
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
double x = i;
cout << x << " " << fixed << setprecision(3) << pow(M_E, 2 * x) - x << "\n";
}
}
int main() {
int n, p, num;
cin >> n;
if(n < 1 or n > 20)
return 0;
else {
vector <int> par;
vector <int> impar;
for(int i = 0; i < n; i++) {
cin >> num;
if(num % 2 == 0)
par.push_back(num);
else
impar.push_back(num);
}
cin >> p;
if(p == 0) {
for(int i = 0; i < par.size(); i++)
cout << par[i] << " ";
}
else {
for(int i = 0; i < impar.size(); i++)
cout << impar[i] << " ";
}
cout << endl;
}
return 0;
}
def conditional_add(a, b):
if a == b:
return 2 * a + 2 * b
return a + b
conditional_add(1, 2)
#include <iostream>
using namespace std;
int main()
{
int x, y, z;
cin >> x >> y >> z;
cout << (x <= y && y <= z) << " " << (x >= y && y >= z);
return 0;
}
#include <iostream>
#include <math.h>
using namespace std;
int main() {
float x, y, pow1, pow2;
int pow3;
cin >> x;
pow1 = pow((x - 1),2);
pow2 = pow((pow1 + (3*x)),3);
cout.precision(2);
cout << fixed << pow2;
return 0;
}