upd: add some files
This commit is contained in:
2
test/testcases/basic-testcases/test0.in
Normal file
2
test/testcases/basic-testcases/test0.in
Normal file
@ -0,0 +1,2 @@
|
||||
#WELCOME!
|
||||
#HAVE A GOOD DAY!
|
0
test/testcases/basic-testcases/test0.out
Normal file
0
test/testcases/basic-testcases/test0.out
Normal file
2
test/testcases/basic-testcases/test1.in
Normal file
2
test/testcases/basic-testcases/test1.in
Normal file
@ -0,0 +1,2 @@
|
||||
#Hello, World!
|
||||
print("Hello, World!")
|
1
test/testcases/basic-testcases/test1.out
Normal file
1
test/testcases/basic-testcases/test1.out
Normal file
@ -0,0 +1 @@
|
||||
Hello, World!
|
4
test/testcases/basic-testcases/test10.in
Normal file
4
test/testcases/basic-testcases/test10.in
Normal file
@ -0,0 +1,4 @@
|
||||
#Function Test
|
||||
def foo():
|
||||
return
|
||||
foo()
|
0
test/testcases/basic-testcases/test10.out
Normal file
0
test/testcases/basic-testcases/test10.out
Normal file
7
test/testcases/basic-testcases/test11.in
Normal file
7
test/testcases/basic-testcases/test11.in
Normal file
@ -0,0 +1,7 @@
|
||||
#Function Test
|
||||
def foo(a):
|
||||
print(a)
|
||||
i = 0
|
||||
while i < 10:
|
||||
foo(i)
|
||||
i += 1
|
10
test/testcases/basic-testcases/test11.out
Normal file
10
test/testcases/basic-testcases/test11.out
Normal file
@ -0,0 +1,10 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
2
test/testcases/basic-testcases/test12.in
Normal file
2
test/testcases/basic-testcases/test12.in
Normal file
File diff suppressed because one or more lines are too long
1
test/testcases/basic-testcases/test12.out
Normal file
1
test/testcases/basic-testcases/test12.out
Normal file
File diff suppressed because one or more lines are too long
80
test/testcases/basic-testcases/test13.in
Normal file
80
test/testcases/basic-testcases/test13.in
Normal file
@ -0,0 +1,80 @@
|
||||
#Pollard Rho
|
||||
def quick_power(x , y , p) :
|
||||
ret = 1
|
||||
while y != 0 :
|
||||
if y % 2 == 1 :
|
||||
ret *= x
|
||||
ret %= p
|
||||
x *= x
|
||||
x %= p
|
||||
y //= 2
|
||||
return ret
|
||||
|
||||
def miller_rabin(x , n) :
|
||||
cnt = 0
|
||||
m = n - 1
|
||||
while m % 2 == 0 :
|
||||
cnt += 1
|
||||
m //= 2
|
||||
x = quick_power(x , m , n)
|
||||
if x == 1 : return True
|
||||
while cnt :
|
||||
cnt -= 1
|
||||
if x == 1 : return False
|
||||
if x == n - 1 : return True
|
||||
x *= x
|
||||
x %= n
|
||||
return x == 1
|
||||
|
||||
def is_prime(x) :
|
||||
if x == 2 or x == 3 or x == 5 or x == 7 or x == 11 or x == 13 or x == 17 or x == 19 or x == 23 or x == 29 or x == 31 or x == 37 : return True
|
||||
if x == 1 or x % 2 == 0 : return False
|
||||
i = 2
|
||||
while i <= 37 :
|
||||
if not miller_rabin(i , x) : return False
|
||||
i += 1
|
||||
return True
|
||||
|
||||
def gcd(x , y) :
|
||||
if y == 0 : return x
|
||||
return gcd(y , x % y)
|
||||
|
||||
def F(n , p , c) : return (n * n + c) % p
|
||||
|
||||
seed = 19260817
|
||||
|
||||
def rand() :
|
||||
seed += seed * 131072
|
||||
seed += seed // 32
|
||||
seed += seed * 4096
|
||||
seed %= 4294967296
|
||||
return seed
|
||||
|
||||
def random(n) : return rand() % n
|
||||
|
||||
def iabs(x) :
|
||||
if x >= 0 : return x
|
||||
else : return -x
|
||||
|
||||
def pollard_rho(n) :
|
||||
#print ("try" , n)
|
||||
if n == 1 : return
|
||||
if is_prime(n) :
|
||||
print(n)
|
||||
return
|
||||
while True :
|
||||
c , p = random(n - 1) + 1 , random(n - 1) + 1
|
||||
q = F(p , n , c)
|
||||
while p != q :
|
||||
g = gcd(iabs(p - q) , n)
|
||||
if g != 1 and g != n :
|
||||
pollard_rho(g)
|
||||
pollard_rho(n // g)
|
||||
return
|
||||
p , q = F(p , n , c) , F(F(q , n , c) , n , c)
|
||||
|
||||
pollard_rho(998244352)
|
||||
print()
|
||||
pollard_rho(809172)
|
||||
print()
|
||||
pollard_rho(151299083768042202434037960)
|
48
test/testcases/basic-testcases/test13.out
Normal file
48
test/testcases/basic-testcases/test13.out
Normal file
@ -0,0 +1,48 @@
|
||||
7
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
17
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
|
||||
2
|
||||
19
|
||||
2
|
||||
3
|
||||
3
|
||||
13
|
||||
13
|
||||
7
|
||||
|
||||
19
|
||||
2
|
||||
2
|
||||
2
|
||||
23
|
||||
7
|
||||
3
|
||||
5
|
||||
13
|
||||
17
|
||||
97
|
||||
19260817
|
||||
998244353
|
4
test/testcases/basic-testcases/test2.in
Normal file
4
test/testcases/basic-testcases/test2.in
Normal file
@ -0,0 +1,4 @@
|
||||
#Print Test
|
||||
print(65536)
|
||||
print(True)
|
||||
print(None)
|
3
test/testcases/basic-testcases/test2.out
Normal file
3
test/testcases/basic-testcases/test2.out
Normal file
@ -0,0 +1,3 @@
|
||||
65536
|
||||
True
|
||||
None
|
6
test/testcases/basic-testcases/test3.in
Normal file
6
test/testcases/basic-testcases/test3.in
Normal file
@ -0,0 +1,6 @@
|
||||
#Variable Test
|
||||
a = 1
|
||||
a = "WELCOME!"
|
||||
#a = 1
|
||||
|
||||
print(a)
|
1
test/testcases/basic-testcases/test3.out
Normal file
1
test/testcases/basic-testcases/test3.out
Normal file
@ -0,0 +1 @@
|
||||
WELCOME!
|
5
test/testcases/basic-testcases/test4.in
Normal file
5
test/testcases/basic-testcases/test4.in
Normal file
@ -0,0 +1,5 @@
|
||||
#Upper Case and Lower Case
|
||||
a = 1
|
||||
A = True
|
||||
b = A
|
||||
print(b)
|
1
test/testcases/basic-testcases/test4.out
Normal file
1
test/testcases/basic-testcases/test4.out
Normal file
@ -0,0 +1 @@
|
||||
True
|
3
test/testcases/basic-testcases/test5.in
Normal file
3
test/testcases/basic-testcases/test5.in
Normal file
@ -0,0 +1,3 @@
|
||||
#Simple Evaluation
|
||||
print(1 + 1) #Love
|
||||
print(1+1) #Hate
|
2
test/testcases/basic-testcases/test5.out
Normal file
2
test/testcases/basic-testcases/test5.out
Normal file
@ -0,0 +1,2 @@
|
||||
2
|
||||
2
|
10
test/testcases/basic-testcases/test6.in
Normal file
10
test/testcases/basic-testcases/test6.in
Normal file
@ -0,0 +1,10 @@
|
||||
#Comparision Test
|
||||
two = 0 + 1 * 2
|
||||
three = two + 1
|
||||
|
||||
print(two < three)
|
||||
print(two > three)
|
||||
print(two <= three)
|
||||
print(two >= three)
|
||||
print(two == three)
|
||||
print(two != three)
|
6
test/testcases/basic-testcases/test6.out
Normal file
6
test/testcases/basic-testcases/test6.out
Normal file
@ -0,0 +1,6 @@
|
||||
True
|
||||
False
|
||||
True
|
||||
False
|
||||
False
|
||||
True
|
10
test/testcases/basic-testcases/test7.in
Normal file
10
test/testcases/basic-testcases/test7.in
Normal file
@ -0,0 +1,10 @@
|
||||
#String Operation Test
|
||||
Hello = "Hello, "
|
||||
World = "World!"
|
||||
print(Hello + World)
|
||||
Hello *= 3
|
||||
print(Hello + "is there anybody in there?")
|
||||
|
||||
cmp = Hello <= World
|
||||
print(cmp)
|
||||
print(not cmp)
|
4
test/testcases/basic-testcases/test7.out
Normal file
4
test/testcases/basic-testcases/test7.out
Normal file
@ -0,0 +1,4 @@
|
||||
Hello, World!
|
||||
Hello, Hello, Hello, is there anybody in there?
|
||||
True
|
||||
False
|
9
test/testcases/basic-testcases/test8.in
Normal file
9
test/testcases/basic-testcases/test8.in
Normal file
@ -0,0 +1,9 @@
|
||||
#If Statement
|
||||
a = 1
|
||||
b = 2
|
||||
if a < b:
|
||||
print(b)
|
||||
# elif a > b:
|
||||
# print(a)
|
||||
# else:
|
||||
# print("equal")
|
1
test/testcases/basic-testcases/test8.out
Normal file
1
test/testcases/basic-testcases/test8.out
Normal file
@ -0,0 +1 @@
|
||||
2
|
5
test/testcases/basic-testcases/test9.in
Normal file
5
test/testcases/basic-testcases/test9.in
Normal file
@ -0,0 +1,5 @@
|
||||
#While Statement Test
|
||||
i = 0
|
||||
while i < 10:
|
||||
print("**********")
|
||||
i += 1
|
10
test/testcases/basic-testcases/test9.out
Normal file
10
test/testcases/basic-testcases/test9.out
Normal file
@ -0,0 +1,10 @@
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
||||
**********
|
Reference in New Issue
Block a user