搜了一下,发现思路和别人的很像,就是用一个字符串常量输出,同时要注意处理里面的特殊字符。
// TOJ1072 输出你自己的代码 Coded by DaNmarner
// 注意!不包括注释!末尾要留一个空行!
#include
<
stdio.h
>
char l = ' / ' ,y = ' " ' ,c = ' ' ;
char * s = " #include <stdio.h>%cchar l='%c%c',y='%c%c',c='%cn';%cchar *s=%c%s%c;%cint main(void){printf(s,c,l,l,l,y,l,c,y,s,y,c,c);return 0;}%c " ;
int main( void ) {printf(s,c,l,l,l,y,l,c,y,s,y,c,c);return 0;}
char l = ' / ' ,y = ' " ' ,c = ' ' ;
char * s = " #include <stdio.h>%cchar l='%c%c',y='%c%c',c='%cn';%cchar *s=%c%s%c;%cint main(void){printf(s,c,l,l,l,y,l,c,y,s,y,c,c);return 0;}%c " ;
int main( void ) {printf(s,c,l,l,l,y,l,c,y,s,y,c,c);return 0;}
很有意思的东西,我检验正确性的办法就是直接把输出定向到一个文本里然后编译它!然后再来!再来!hoho~