Created
October 31, 2014 21:26
-
-
Save yinyanghu/d654009ae478d2e7f748 to your computer and use it in GitHub Desktop.
IOCCC 2011 Winner -- Qiming Hou
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#define clear 1;if(c>=11){c=0;sscanf(_,"%lf%c",&r,&c);while(*++_-c);}\ | |
else if(argc>=4&&!main(4-(*_++=='('),argv))_++;g:c+= | |
#define puts(d,e) return 0;}{double a;int b;char c=(argc<4?d)&15;\ | |
b=(*_%__LINE__+7)%9*(3*e>>c&1);c+= | |
#define I(d) (r);if(argc<4&&*#d==*_){a=r;r=usage?r*a:r+a;goto g;}c=c | |
#define return if(argc==2)printf("%f\n",r);return argc>=4+ | |
#define usage main(4-__LINE__/26,argv) | |
#define calculator *_*(int) | |
#define l (r);r=--b?r: | |
#define _ argv[1] | |
#define x | |
double r; | |
int main(int argc,char** argv){ | |
if(argc<2){ | |
puts( | |
usage: calculator 11/26+222/31 | |
+~~~~~~~~~~~~~~~~~~~~~~~~calculator-\ | |
! 7.584,367 ) | |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ | |
! clear ! 0 ||l -x l tan I (/) | | |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ | |
! 1 | 2 | 3 ||l 1/x l cos I (*) | | |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ | |
! 4 | 5 | 6 ||l exp l sqrt I (+) | | |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ | |
! 7 | 8 | 9 ||l sin l log I (-) | | |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(0 | |
); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment