Answers for "convert python code to c++ online"

0

convert python code to c++ online

def ceil_function(n): 
    res = int(n) 
    return res if res == n or n < 0 else res+1 
def cars(n1, n2, x): 
    if n1>=n2: 
        return -1 
    rel = n2 - n1 
    t_double = (x+1)/rel 
    t = ceil_function(t_double) 
    return t 
 
n1=int(input()) 
n2=int(input()) 
x=int(input()) 
print(cars(n1, n2, x))
Posted by: Guest on August-08-2021
0

convert python code to c++ online

name=int(input("name: "))
Posted by: Guest on October-05-2021
0

convert python code to c++ online

#Use input() to read input from STDIN and use print to write your output to STDOUT
def check(s1,s2):
    a=len(s1)
    b=len(s2)
    i=j=0
    while j<a and i<b:
        if s1[j] == s2[i]:
            j+=1
        i+=1
    return j==a
def main():
    v=input()
    n=int(input())
    x=[]
    for i in range(n):
        x.append(input())
    for i in x:
        print("POSITIVE" if check(i,v) else "NEGATIVE")  
main()
Posted by: Guest on June-07-2021
0

convert python code to c++ online

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
Posted by: Guest on May-01-2021
0

convert python code to c++ online

n=int(input())
l=list(map(int,input().split()))
max=0
num=l[0]
for i in l:
    freq=l.count(i)
    if freq>max:
        max=freq
        num=i
x=l.count(num)
y=n-x
print(y)
Posted by: Guest on July-09-2021
0

convert python code to c++ online

import java.util.*;

class Program {
  public static String caesarCypherEncryptor(String str, int key) {
		char[] newLetters = new char[str.length()];
		int newKey = key % 26;
		for(int i = 0; i < str.length(); i++) {
			newLetters[i] = getNewLetters(str.charAt(i), newKey);//A
		}
    return new String(newLetters);//B
  }
	public static char getNewLetters(char letter, int key) {
		int  newLetterCode = letter + key;//C
		return newLetterCode <= 122 ? (char) newLetterCode : (char) (96 + newLetterCode % 122);
	}
}
Posted by: Guest on September-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language