#define USE_TI89 #define RETURN_VALUE #define OPTIMIZE_ROM_CALLS #define MIN_AMS 200 #define ENABLE_ERROR_RETURN #include void _main(void) { if(ArgCount() > 2) ER_throw(940); ESI q = top_estack; char *a[19] = {"1s","2s","2p","3s","3p","4s","3d","4p","5s","4d","5p","6s","4f","5d","6p","7s","5f","6d","7p"}, b[19] = {2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6}, c = 0, d[81] = "", *h[6] = {"He","Ne","Ar","Kr","Xe","Rn"}, i = 5, j[6] = {2,10,18,36,54,86}, x = GetIntArg(q); switch(GetIntArg(q)) { case 1: for(;i>=0;--i) if(x > j[i]) { sprintf(d,"[%s] ",h[i]); x -= j[i]; c = 2*(i+(i-3)*(i>3))+(i==3)+1; break; } case 0: for(;;++c) { strcat(d,a[c]); if(x<=b[c]) { sprintf(d,"%s%d",d,x); push_zstr(d); return; } x -= b[c]; sprintf(d,"%s%d ",d,b[c]); } default: ER_throw(260); } }