wrong answer

jheee Reply 9 years 3 weeks ago
#include <stdio.h> int main() { int h; int a=0; int b=0; while ((h=getchar())!='!') { if (h!='/'&&h!='\"'&&h!='\n'&&b==0) {putchar(h); a=0; b=0;} else if(h=='/'&&b==0&&h!='\n') {b=1; a=0; } else if(h=='*'&&b==1&&h!='\n') {b=2; a=0; } else if(h=='*'&&b==2&&h!='\n') {b=1; a=0; printf(" ");} else if(h=='/'&&b==1&&h!='\n') {b=0; a=0; } else if (h=='\"'&&a==0&&b==0&&h!='\n') {b=3; putchar(h); a=1;} else if(b==3&&h!='\"'&&h!='\n') putchar(h); else if(h=='\"'&&a==1&&b==3&&h!='\n') { putchar(h); b=0; a=1;} else if(h=='\n') {putchar(h); b=0; a=1; } } return 0; } 이클립스에서는 정답과 똑같이 뜨는데... 이렇게 하면 안되나요?
pichulia Reply 9 years 3 weeks ago
/* * /abcd 위의 데이터를 한번 넣어보시면 어디가 잘못됐는지 알 수 있을겁니다. 그나저나 이거 지금상태에서부터 수정하기가 꽤나 난해해보이네요..화이팅!
jheee Reply 9 years 3 weeks ago
감사합니다!!