七行プログラミング part2
レス数が950を超えています。1000を超えると書き込みができなくなります。
0993989
NGNG"(* (+ 2 3) 4)" みたいな計算ができる。
貧弱な上短くする余地もまだまだある、つーか手抜きだが、その辺は好きに弄ってくれ。
#include<stdio.h>
char s[999],*p=s;a(void){int r=0;if(*p=='('){char c=*++p;++p;while(*p==32)++p;
if(c=='+')r=a()+a();else if(c=='-')r=a()-a();else if(c=='*')r=a()*a();else if(
c=='/')r=a()/a();else if(c=='%')r=a()%a();else if(c=='p'){r=a();printf("%d\n",
r);}++p;}else do{r=r*10+*(p++)-'0';}while(*p!=32&&*p!=0&&*p!=')');while(*p==32
)++p;return r;}main(){gets(s);printf("%d\n",a());return 0;}
レス数が950を超えています。1000を超えると書き込みができなくなります。