xxxxxxxxxx
div body #java-to-python {
font-size: max(blue, 20rem, min(red, calc(yellow + 200%)));
}
xxxxxxxxxx
#include<stdio.h>
int stack[10000000]={0};
int top=-1;
void push(int c)
{
stack[++top]=c;
}
void pop()
{
stack[top--]=0;
}
int main()
{
int N,max=0;
int order=1;
scanf("%d",&N);
int arr[N];
for(int i=0;i<N;i++)
{
scanf("%d",&arr[i]);
if(max<arr[i])
max=arr[i];
}
for(int i=0;i<N;i++)
{
while(top!=-1 && stack[top]==order)
{
order++;
pop();
}
if(arr[i]==order)
{
order++;
}
else
push(arr[i]);
}
while(top!=-1 && stack[top]==order)
{
order++;
pop();
}
if(order==max+1)
printf("Happy");
else
printf("Sad");
}
xxxxxxxxxx
public class testint
{
public static void main(String[] args)
{
boolean contain= false;
int valeurATrouver=5;
int ints[] ={1,4,5};
for(int i=0;i<ints.length;i++)
{
if(ints[i]==valeurATrouver)
{
contain=true;
}
}
if(contain){System.out.println("La valeur "+valeurATrouver+" est comprise dans le tableau");}
else{System.out.println("La valeur "+valeurATrouver+" n'est pas comprise dans le tableau");}
}
}
xxxxxxxxxx
s=input()
l=[]
s1='aeiou'
sum1=0
def snm(sum1):
t=0
while(sum1>0 or t>9):
if(sum1==0):
sum1=t
t=0
t=t+sum1%10
sum1=sum1//10
return t
for i in range(len(s)):
if s[i] in s1:
l.append(i)
for j in range(len(l)):
k=l[j]*5
sum1=0
for h in range(1,k+1,2):
sum1=sum1+h
print(snm(sum1))
xxxxxxxxxx
def BitmapHoles(strArr):
bitmap = {}
for i in range(len(strArr)):
for j in range(len(strArr[i])):
bitmap[(i,j)] = int(strArr[i][j])
hole_count = 0
hole = set()
checked = set()
flag = True
for i in range(len(strArr)):
for j in range(len(strArr[i])):
stack = [(i,j)]
while stack:
coords = stack.pop()
if coords not in checked:
checked.add(coords)
if bitmap[coords] == 0 and coords not in hole:
hole.add(coords)
if flag == True:
hole_count += 1
flag = False
if coords[0] - 1 >= 0 and (coords[0]-1,coords[1]) not in checked:
stack.append((coords[0]-1,coords[1]))
if coords[0] + 1 < len(strArr) and (coords[0]+1,coords[1]) not in checked:
stack.append((coords[0]+1,coords[1]))
if coords[1] - 1 >= 0 and (coords[0],coords[1]-1) not in checked:
stack.append((coords[0],coords[1]-1))
if coords[1] + 1 < len(strArr[coords[0]]) and (coords[0],coords[1]+1) not in checked:
stack.append((coords[0],coords[1]+1))
flag = True
return hole_count
xxxxxxxxxx
def BitmapHoles(strArr):
bitmap = {}
for i in range(len(strArr)):
for j in range(len(strArr[i])):
bitmap[(i,j)] = int(strArr[i][j])
hole_count = 0
hole = set()
checked = set()
flag = True
for i in range(len(strArr)):
for j in range(len(strArr[i])):
stack = [(i,j)]
while stack:
coords = stack.pop()
if coords not in checked:
checked.add(coords)
if bitmap[coords] == 0 and coords not in hole:
hole.add(coords)
if flag == True:
hole_count += 1
flag = False
if coords[0] - 1 >= 0 and (coords[0]-1,coords[1]) not in checked:
stack.append((coords[0]-1,coords[1]))
if coords[0] + 1 < len(strArr) and (coords[0]+1,coords[1]) not in checked:
stack.append((coords[0]+1,coords[1]))
if coords[1] - 1 >= 0 and (coords[0],coords[1]-1) not in checked:
stack.append((coords[0],coords[1]-1))
if coords[1] + 1 < len(strArr[coords[0]]) and (coords[0],coords[1]+1) not in checked:
stack.append((coords[0],coords[1]+1))
flag = True
return hole_count
xxxxxxxxxx
import java.util.Scanner;
public class Factorial {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Ingresa un numero para calcular su factorial: ");
int num = sc.nextInt();
System.out.println("Factorial de " + num + " es: " + factorial(num));
}
private static int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n - 1);
}
}
}
xxxxxxxxxx
public static double area(int n, double side){
double area = ( n*side*side)/4* Math.tan(3.14/n);
return area;
}
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
System.out.println("Enter n and side");
int n = scan.nextInt();
double side = scan.nextDouble();
System.out.println(area(n, side));
}
}