xxxxxxxxxx
import org.python.util.PythonInterpreter;
public class JythonHelloWorld {
public static void main(String[] args) {
try(PythonInterpreter pyInterp = new PythonInterpreter()) {
pyInterp.exec("print('Hello Python World!')");
}
}
}
xxxxxxxxxx
#!/usr/bin/python
"""mapper.py"""
from __future__ import print_function
import sys
for line in sys.stdin:
number = int(line)
print(number, '1')
xxxxxxxxxx
switch(escalaParaConverter){
case 'C':
if(this.getTemp().getEscala()=='K') this.kelvinParaCelsius();
else if(this.getTemp().getEscala()=='F') this.fahrenheitParaCelsius();
break;
case 'K':
if(this.getTemp().getEscala()=='C') this.celsiusParaKelvin();
else if(this.getTemp().getEscala()=='F') this.fahrenheitParaKelvin();
break;
case 'F':
if(this.getTemp().getEscala()=='C') this.celsiusParaFahrenheit();
else if(this.getTemp().getEscala()=='K') this.kelvinParaFahrenheit();
break;
}
xxxxxxxxxx
k, m, a, b = int(input()), int(input()), int(input()), int(input())
res = 0
for i in range(a, b+1):
if i % k == 0:
res += 1
if i % m == 0:
res -= 1
print(res)
xxxxxxxxxx
def average():
sum=0
n=int(input())
p=int(input())
for i in range(n,(n*p+1),n):
sum=sum+i
return int(sum/p)
print(average())
xxxxxxxxxx
def neighbour(map, node, m, n):
calc_neighbour= [-8, -7, 1, 9, 8, 7, -1, -9]
neighbour=[]
for i in range(0,len(map[node])):
a = map[node][i]
if(a==1):
x= node+calc_neighbour[i]+1
if(x>0 and x<=m*n):
neighbour.append(x)
return neighbour
xxxxxxxxxx
import java.util.*;
class D
{
public static void main(string args[])
}
int a[]=new int[5];
int b[]=new int[5];
Scanner kb=new Sacnner(System.in;
for(intcj=0;j<=2;j++)
{
a[j]=kb.nextInt();
for(int k=0;k<=2;k++)
}
b[k]=kb.nextInt();
}
int r1=a[2];
int r2=a[2];
double x=3.14*(double)r1*r1;
double y=3.14*(double)r2*r2;
double sum=x+y;
double ans=(1.813/sum)*100;
System.out.printf("%.2f",ans);
xxxxxxxxxx
class Solution(object):
def distributeCandies(self, candies, num_people):
res = [0 for i in range(num_people)]
index = 0
while candies>0:
res[index%num_people] += min(candies,index+1)
candies-=(index+1)
index+=1
return res
ob1 = Solution()
xxxxxxxxxx
import math
def isPerfectSquare(x):
s = int(math.sqrt(x))
return s*s == x
def isPrime(n):
if n <= 1:
return 0
for i in range(2, n):
if n % i == 0:
return 0;
return 1
def solve(n):
flag = 0
if isPrime(n):
if isPerfectSquare(5*n*n + 4) or isPerfectSquare(5*n*n - 4):
flag = 0
else:
flag = 1
return flag
xxxxxxxxxx
from selenium import webdriver
def main(Text):
options = webdriver.FirefoxOptions()
options.add_argument("-headless")
driver = webdriver.Firefox(options=options)
driver.maximize_window()
search_string = Text
frmtd_search_s = search_string.replace(" ","_")
driver.get(f"https://en.wikipedia.org/wiki/{frmtd_search_s}")
if "Wikipedia Does not have an article with this exact name." in driver.page_source:
return("Sorry we couldn't find a wikipedia page for your search :(")
else:
body = driver.find_element_by_id("bodyContent")
p_tags = body.find_elements_by_tag_name("p")
for p_tag in p_tags:
return{p_tag.text}
xxxxxxxxxx
n = int(input())
while n > 0:
n -= 1
m = int(input())
a = input().split()
for ind, i in enumerate(a):
a[ind] = int(a[ind])
b = sorted(a)
b.reverse()
total = 0
for ind, i in enumerate(a):
if (a[ind] == b[ind]):
total +=1
print(total)