#include<stdio.h> #define M(x)!memcmp(e+d,k[x],3) #define V(x)} void x(int s){ #define W( x)putchar(x); #include <string.h> #include <math.h> #define R return #define C(x, X/**/\ )case x:R (X);; char* k[19 ]= {"-" ,"+", "%", "/" ,"*" ,"-" ,/* */ "e" "xp" ,"ln" ,"" "l" "o" "g", "at" "a" "n", "ac" "o" "s", "as" "i" "n" ,"tan" ,"co" "s" , "s" "in" /*E! SY! */# define E else /* Be ^_^ \*/ #/* D! /*/ define P printf /*\ int "!" \*/ ,"^" ,"(" ,"e" ,"PI"} ,e[ 2049 ]; int d,m ,l,p ,u[1 <<+ 12], n[2048] ,w [1<< 12] ,v[ 0+ 2048 +0] ,q, c,i; double t [0+ 2048] ,o ;/* )== \*/ /*19 99 /*/# define j( x)((x>47&&x<58) ||( +x) ==( 46)) /*g ain ax*/ double f( int r){switch(u[r]) {C( 34 +0, fmod ( f( n[r]),f( w[r ]) ))C (294 ,atan2 ( 0,- 1) )C( 278, exp (1) )C( 132,log10(f( w[r ]) ))C (66 ,f( n[r ]) *f( w[ r]) )C( 50 ,f( n[r])/f (w[r]) )C( 116 ,+ log (f (w[ r] )/* */)) /*|/ :) */# define /*(c) Nov 05 99 DON */F /* */E /* */if C(1 ,f (n[ r])-f( w[r ])) C( 245 +0, pow (f( n[ r]) ,f( w[r ])) )C( 100, exp (f( w[ r]) ))C (17 ,f( n[r ]) +f(w [r] ))C (83 ,-f( w[r ])) C(228, sin (f( w[r ]) ))C (0+ 262 ,f( w[r ]))C( 180 +0, asin(f (w[ r]) ))C( 212 +0, cos (f(w [r] )))C (164 ,/* |*/ acos (f( w[r ]))) C( 0+ 196, tan (f( w[r] )))C( 148 +0, atan (f( w[r ])))} R(t [r ]); V(g )for (m=+ l=!P( "%s " ,k[ s>>4 ]); u[v [c]]- 262 &&( u[v [c] ]&7 )>=( s&7) ;c=v[ c]) ;v[ q]= v[n [q] =c];u[v[ c]= w[v [q] ]=q ]=s;c =q++;V(h)if (m) g( 66) ;if (s==310){m=P( "" "%" "lG ", t[q]= o);}F(s==+ 294 || s== 278){m =+P( /* \|*/ "%s ", k[s>> 4]);}E{if( 262 == s) {p++; if( l) W(8 )}m =! P("%s" ,k[s>>4 ]);}l =0 ;if( s> +99 &&+ 229 >s )l=W(+ 32 )u[q ]=s; v[w[c]= q]=c +0; c=q++;;} int main( int a/* suz uki /*/,char/*e nom oto*/*b[ ]){ if(a==1)R P(" ?\n "); strcpy(e,b[q=1 ]); for (i= 2;i <a;strcat (e, b[i ++]));; strlwr (e);{ ;} for (u[ (d= m=p= c=0 )]= 262 ;e[d];){if( j(e[d ])){; sscanf (e+ +d, "%l" "f" "" , &o);; for(h (310 );j( e[ d]) ;d ++);if(e [d] == 101) {d++ ;if( e[d] -43&&e [d] -45)d-- ;for (d ++;e [d]> 47&& e[ d]<+58 ;d ++) ;}}F(e[d ]> 97&& +117 >e[ d]){if (M( +14 ))h( 228 ); F(M( 13)) h (212) /* */;F(M( 12) )h (196 ); F(M(+ 6)) h(100) ;F(M(8 ))h( 132+ 0);E {if(! memcmp (( e+d),"pi", 2)) h(294 );F (!memcmp(e +d, "ln", 2 ))h (116 );E {if (+101 == e[d ])h (278 );d --; }d--; }d +=3 ;} F(97 ==e [d] ){d+= 1; if( M(14) )h( 180); F(M(( 13 )) )h (164) ;F(M (12))h(148);E d/* */ -= +3;d+= +3; }E{ i=e[d++] ;if (m ){if(40 ==+ i){ h(262);} F( i== 41&& +p) {P( "%" "c)%c" ,8 ,+ 32); for (c =(+ v[c]) ; 262-u [c ];c =v[c ]);p --;}E {if (42== i)g(66 );F(47 ==i )g(50); F(i== 37)g(34 );F (i==43)g (17) ;F(i==45) g(1) ;F( i==94)g( 245);}}E{if (40 ==i )h(262);F(i== 45)h(83);}}}if(!m) { o=0;h(310);}for(i=!W(8)i++<p;)W(41)R!P( "\n=\40%.16lG\n",f(0));} |