“Convertir le code Python en java” Réponses codées

Convertir le code Python en java

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
Long Lion

Convertir le code Python en java

def tipo_melenudos(lista):
    lista_nueva=[]
    for i in range(len(lista)):
        if lista[i] not in lista_nueva:
            lista_nueva.append(lista[i])
    return lista_nueva
Better Bison

Convertir le code Python en java

def tipo_melenudos(lista):
    lista_nueva=[]
    for i in range(len(lista)):
        if lista[i] not in lista_nueva:
            lista_nueva.append(lista[i])
    return lista_nueva
Better Bison

Convertir le code Python en java

name=input("enter name:")
majorr=input("enter major:")
minorr=input("enter minor:")
f="\n"+name+".lst:"+majorr+":"+minorr+":arbic"
p=f.replace(' ','')
file1 = open(r"C:\gate\GATE_Developer_8.1\plugins\Lang_Arabic\resources\gazetteer\lists.def","a+")
file1.write(p)
file1 = open(rf"C:\gate\GATE_Developer_8.1\plugins\Lang_Arabic\resources\gazetteer\{name}.lst","a+")
Add_item=input("enter item:")
file1.write(Add_item)
Lonely Lemur

Convertisseur Python à Java

print("heelo")
Prickly Plover

Réponses similaires à “Convertir le code Python en java”

Questions similaires à “Convertir le code Python en java”

Plus de réponses similaires à “Convertir le code Python en java” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code