Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 4 +/@$/@$~/@$~ 3
- 1.34078e154
- t=.+/@$/@$~/@$~ NB. define a function
- 4 t 3
- 1.34078e154
- 2 t 2
- 4
- import Data.List
- t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
- Prelude> :m +Data.List
- Prelude Data.List> let t x=genericLength.(iterate(sequence.map(const$replicate x[]))[[]]!!)
- Prelude Data.List> t 2 2
- 4
- Prelude Data.List> t 2 4
- 65536
- Prelude Data.List> t 4 3
- ~])*1+{[]+*{*}*}*
- ~])*{[]+*{*}*}*
- */@$~/1,~$~/
- h=:[:*/@$~/1,~$~/
- h 2 4
- 65536
- */@$~/1,~$~/".1!:1]1
- ~1{1{0{+}?}?}{@+@*}:?~
- ~1{1{*}?}{@+@*}:?~
- a,b=map(int,raw_input().split())
- exec"eval('*'.join('a'*"*b+'1'+'))'*b
- sub t
- {
- ($x,$y,$z)=@_;
- $y>1&&t($x,$y-1,eval$x."*$x"x($z-1||1))||$z
- }
- print t(2,4,1)
- type B=BigInt
- def r(a:B,b:B,f:(B,B)=>B):B=if(b>1)f(a,r(a,b-1,f))else a
- def h(a:B,b:B)=r(a,b,r(_,_,r(_,_,(_+_))))
- type B=BigInt
- def recursive (a:B, b:B, f:(B,B)=>B): B =
- if (b>1) f (a, recursive (a, b-1, f))
- else a
- recursive (2, 3, recursive (_, _, recursive (_, _, (_ + _))))
- type B=BigInt
- def p (a:B, b:B):B = a+b
- def m (a:B, b:B):B = if (b>1) p (a, m (a, b-1)) else a
- def h (a:B, b:B):B = if (b>1) m (a, h (a, b-1)) else a
- def t (a:B, b:B):B = if (b>1) h (a, t (a, b-1)) else a
- def r (a:B, b:B, f:(B,B)=>B):B =
- if (b>1) f(a, r(a, b-1, f)) else a
- r (4, 3, r (_,_, r(_,_, (_+_))))
- def h(a:B,b:B)=r(a,b,r(_,_,(_*_))) // size -7, penalty + 5
- def h(a:B,b:B)=r(a,b,r(_,_,r(_,_,(_+_))))
- type B=BigInt
- def p(a:B,b:B):B=a+b
- import annotation._
- @tailrec
- def m(a:B,b:B,c:B=0):B=if(b>0)m(a,b-1,p(a,c))else c
- @tailrec
- def h(a:B,b:B,c:B=1):B=if(b>0)h(a,b-1,m(a,c))else c
- @tailrec
- def t(a:B,b:B,c:B=1):B=if(b>0)t(a,b-1,h(a,c))else c
- // 124 = 119-5 bonus
- type B=BigInt
- def r(a:B,b:B,c:B,f:(B,B)=>B):B=if(b>0)r(a,b-1,f(a,c),f)else c
- def t(a:B,b:B)=r(a,b,1,r(_,_,1,r(_,_,0,(_+_))))
- // 115 without bonus
- type B=BigInt
- def r(a:B,b:B,c:B,f:(B,B)=>B):B=if(b>0)r(a,b-1,f(a,c),f)else c
- def t(a:B,b:B)=r(a,b,1,r(_,_,1,(_*_)))
- timed ("t(4,3)")(t(4,3))
- t(4,3): 1
- scala> t(4,3)
- res89: B = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096
- def e(x,y)
- r=1
- (1..y).each{t=x
- (2..r).each{t*=x}
- r=t}
- r
- end
- m@f_:=Fold[f,1,#2~Table~{#}]&;
- m[m@Sum]
- m[m@Sum][3, 4]
- r=xrange
- def m(x,y):
- i=0
- for n in r(y):i+=x
- return i
- def e(x,y):
- i=1
- for n in r(1,y+1):i=m(i,x)
- return i
- def t(x,y):
- i=1
- for n in r(y):i=e(x,i)
- return i
- t(2, 4)
- import sys
- p=lambda y:y and x*p(y-1)or 1
- t=lambda y:y>1 and p(t(y-1))or x
- x,y=map(long,sys.argv[1:])
- print t(y)
- x,y,z;
- double R(){return--y?!z?y=R(),R(z=1):x*R():x;}
- main(){
- scanf("%d%d",&x,&y);
- printf("%fn",R());
- }
- USING: eval io kernel locals math prettyprint sequences ;
- IN: g
- :: c ( y x o! -- v )
- o 0 = [ x y * ] [ o 1 - o!
- y x <repetition> 1 [ o c ] reduce ] if ;
- contents eval( -- x y ) swap 2 c .
- USING: eval io kernel locals math prettyprint sequences ;
- IN: script
- ! Calculate by opcode:
- ! 0 => x * y, multiplication
- ! 1 => x ^ y, exponentiation
- ! 2 => x ^^ y, tetration
- :: calculate ( y x opcode! -- value )
- opcode 0 = [
- x y *
- ] [
- ! Decrement the opcode. Tetration is repeated exponentiation,
- ! and exponentiation is repeated multiplication.
- opcode 1 - opcode!
- ! Do right-associative reduction. The pattern is
- ! seq reverse 1 [ swap ^ ] reduce
- ! but a repetition equals its own reverse, and 'calculate'
- ! already swaps its inputs.
- y x <repetition> 1 [ opcode calculate ] reduce
- ] if ;
- contents eval( -- x y ) ! Read input.
- swap 2 calculate . ! Calculate tetration. Print result.
- USING: eval kernel math.functions prettyprint sequences ;
- contents eval( -- x y ) swap <repetition> 1 [ swap ^ ] reduce .
- i f x 1=x;i f x n=f$i f x$n-1
- t=i(o n->i(o n)n)(+)4
- bump op n a = iterate (op n) n !! (fromIntegral $ a-1)
- tetrate = iterate bump (+) !! 3
- Prelude> let i f x 1=x;i f x n=f$i f x$n-1
- (0.00 secs, 1564024 bytes)
- Prelude> let t=i(o n->i(o n)n)(*)3
- (0.00 secs, 1076200 bytes)
- Prelude> t 4 3
- 13407807929942597099574024998205846127479365820592393377723561443721764030073546
- 976801874298166903427690031858186486050853753882811946569946433649006084096
- (0.01 secs, 1081720 bytes)
- function t(i){y=i.split(' ');a=y[0];b=y[1];return+b&&p(a,t(a+' '+(b-1)))||1}function p(a,b){return+b&&a*p(a,b-1)||1}
- 1.3407807929942597e+154
- r=lambda x,y:(x for _ in range(y));t=lambda x,y:reduce(lambda y,x:reduce(lambda x,y:sum(r(x,y)),r(x,y)),r(x,y),1)
- data N=Z|S N
- a&+Z=a
- a&+S b=S$a&+b
- _&*Z=Z
- a&*S b=a&+(a&*b)
- _&^Z=S Z
- a&^S b=a&*(a&^b)
- _&>Z=S Z
- a&>S b=a&^(a&>b)
- f 0=Z
- f a=S$f$a-1
- t Z=0
- t(S a)=1+t a
- main=interact$show.f.([x,y]->x&>y).map(f.read).words
- (lambda(b c)(let((r b)u)(dotimes(c c r)(setf u 1 r(dotimes(c b u)(setf u(* u r)))))))
- (lambda(a b)(eval`(*,@(loop for x below b nconc(loop for x below a nconc`(,a,a))))))
- a,b=input().split()
- r=1;exec("r=eval((a+'*')*r+'1');"*int(b))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement