/ Vijos / 讨论 / 问答 /

一道神题!!!!望大牛们给出代码!!!

只有一道题:
请编写一个程序,使之能够输出自己的源代码(忽略空格,但**每一行**一定要对应!!)

错误样例
###Block code
#include<iostream>
using namespace std;
int main()
{
cout<<"#include<iostream>"<<endl<<"#include<iostream>"<<endl<<"using namespace std;"<<endl<<"int main()"<<endl<<"{"<<endl<<"cout"<<endl<<"return 0;"<<endl<<"}";
return 0;
}

这样输出的是:
#include<iostream>
using namespace std;
int main()
{
cout
return 0;
}
明显不一样!!

必须要求源代码和输出**一模一样**!!
不知各位大牛能不能做出来,呵呵呵呵呵。。。。。。
强烈建议twd2将此题放入题库,并且做出来的赏1000RP!!
orz!!!

18 条评论

  • @ 2014-12-17 19:17:54

    orz

  • @ 2014-12-14 17:48:14

    开文件乱搞。。

  • @ 2014-11-02 15:32:00

    能不能assign(f,'auto.pas')之后各种乱搞。。。

  • @ 2014-11-02 15:00:38

    #include <iostream>
    #include <string>
    using namespace std;

    int main()
    {
    char q = 34;
    string l[] = {
    " ",
    "#include <iostream>",
    "#include <string>",
    "using namespace std;",
    "",
    "int main()",
    "{",
    " char q = 34;",
    " string l[] = {",
    " };",
    " for(int i = 1; i <= 8; i++)",
    " cout << l[i] << endl;",
    " for(int i = 0; i <= 17; i++)",
    " cout << l[0] + q + l[i] + q + ',' << endl;",
    " for(int i = 9; i <= 17; i++)",
    " cout << l[i] << endl;",
    " return 0;",
    "}",
    };
    for(int i = 1; i <= 8; i++)
    cout << l[i] << endl;
    for(int i = 0; i <= 17; i++)
    cout << l[0] + q + l[i] + q + ',' << endl;
    for(int i = 9; i <= 17; i++)
    cout << l[i] << endl;
    return 0;
    }
    这个大概是好的

  • @ 2014-11-02 14:48:49

    感觉不可能吧……就像屏幕里的屏幕一样怎么穷尽

  • @ 2014-11-02 14:33:56

    这也能解?!臣妾做不到啊~~~~(>_<)~~~~

  • @ 2014-11-02 11:14:50

    贴标程:
    #include <iostream>
    #include <string>
    using namespace std;

    int main(int argc, char* argv[])
    {
    char q = 34;
    string l[] = {
    " ",

    "=============<<<<<<<< Java Code >>>>>>>>=============",
    "public class Quine",
    "{",
    " public static void main(String[] args)",
    " {",
    " char q = 34;",
    " String[] l = {",
    " };",
    " for(int i = 2; i <= 9; i++)",
    " System.out.println( l[i] );",
    " for(int i = 0; i < l.length; i++)",
    " System.out.println(l[0] + q + l[i] + q + ',');",
    " for(int i = 10; i <= 18; i++)",
    " System.out.println(l[i]);",
    " }",
    "}",
    "=============<<<<<<<< C++ Code >>>>>>>>=============",
    "#include <iostream>",
    "#include <string>",
    "using namespace std;",
    "",
    "int main(int argc, char* argv[])",
    "{",
    " char q = 34;",
    " string l[] = {",
    " };",
    " for(int i = 18; i <= 25; i++)",
    " cout << l[i] << endl;",
    " for(int i = 0; i <= 34; i++)",
    " cout << l[0] + q + l[i] + q + ',' << endl;",
    " for(int i = 26; i <= 34; i++)",
    " cout << l[i] << endl;",
    " return 0;",
    "}",
    };
    for(int i = 18; i <= 25; i++)
    cout << l[i] << endl;
    for(int i = 0; i <= 34; i++)
    cout << l[0] + q + l[i] + q + ',' << endl;
    for(int i = 26; i <= 34; i++)
    cout << l[i] << endl;
    return 0;
    }

  • @ 2014-11-02 08:33:01

    #include <cstdio>
    char* wtf="#include <cstdio>%cchar* wtf=%c%s%c;%cint main(){printf(wtf,10,34,wtf,34,10,10);}%c";
    int main(){printf(wtf,10,34,wtf,34,10,10);}

    @xiangshang12

    • @ 2014-11-02 11:01:30

      #include <cstdio>
      char wtf="#include <cstdio>%cchar wtf=%c%s%c;%cint main(){printf(wtf,10,34,wtf,34,10,10);}%c";
      int main(){printf(wtf,10,34,wtf,34,10,10);}

    • @ 2014-11-02 11:10:50

      运行不了。。。。。

  • @ 2014-11-01 23:16:33

    program auto;
    type
    str=string[255];
    var
    c:array[0..15] of str;
    i:integer;
    begin
    c[ 0]:='''';
    c[ 1]:=' c[';
    c[ 2]:=']:=';
    c[ 3]:=';';
    c[ 4]:='program auto;';
    c[ 5]:='type';
    c[ 6]:=' str=string[255];';
    c[ 7]:='var';
    c[ 8]:=' c:array[0..15] of str;';
    c[ 9]:=' i:integer;';
    c[10]:='begin';
    c[11]:=' for i:=4 to 10 do writeln(c[i]);';
    c[12]:=' writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);';
    c[13]:=' for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);';
    c[14]:=' for i:=11 to 15 do writeln(c[i]);';
    c[15]:='end.';
    for i:=4 to 10 do writeln(c[i]);
    writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);
    for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);
    for i:=11 to 15 do writeln(c[i]);
    end.

  • @ 2014-11-01 23:15:40

    ####Blok code
    program auto;
    type
    str=string[255];
    var
    c:array[0..15] of str;
    i:integer;
    begin
    c[ 0]:='''';
    c[ 1]:=' c[';
    c[ 2]:=']:=';
    c[ 3]:=';';
    c[ 4]:='program auto;';
    c[ 5]:='type';
    c[ 6]:=' str=string[255];';
    c[ 7]:='var';
    c[ 8]:=' c:array[0..15] of str;';
    c[ 9]:=' i:integer;';
    c[10]:='begin';
    c[11]:=' for i:=4 to 10 do writeln(c[i]);';
    c[12]:=' writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);';
    c[13]:=' for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);';
    c[14]:=' for i:=11 to 15 do writeln(c[i]);';
    c[15]:='end.';
    for i:=4 to 10 do writeln(c[i]);
    writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);
    for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);
    for i:=11 to 15 do writeln(c[i]);
    end.

  • @ 2014-11-01 23:09:31

    program auto;
    type
    str=string[255];
    var
    c:array[0..15] of str;
    i:integer;
    begin
    c[ 0]:='''';
    c[ 1]:=' c[';
    c[ 2]:=']:=';
    c[ 3]:=';';
    c[ 4]:='program auto;';
    c[ 5]:='type';
    c[ 6]:=' str=string[255];';
    c[ 7]:='var';
    c[ 8]:=' c:array[0..15] of str;';
    c[ 9]:=' i:integer;';
    c[10]:='begin';
    c[11]:=' for i:=4 to 10 do writeln(c[i]);';
    c[12]:=' writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);';
    c[13]:=' for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);';
    c[14]:=' for i:=11 to 15 do writeln(c[i]);';
    c[15]:='end.';
    for i:=4 to 10 do writeln(c[i]);
    writeln(c[1],0:2,c[2],c[0],c[0],c[0],c[0],c[3]);
    for i:=1 to 15 do writeln(c[1],i:2,c[2],c[0],c[i],c[0],c[3]);
    for i:=11 to 15 do writeln(c[i]);
    end.

  • @ 2014-10-31 16:21:06

    我是做广告的。。。。
    @VFleaKing

  • @ 2014-10-31 13:09:20

    main(){char* s="main(){char* s=%c%s%c;printf(s,34,s,34);return 0;}";printf(s,34,s,34);return 0;}

    • @ 2014-10-31 13:09:32

      main(){char* s="main(){char* s=%c%s%c;printf(s,34,s,34);return 0;}";printf(s,34,s,34);return 0;}

    • @ 2014-11-01 21:54:47

      运行不了呀????

  • @ 2014-10-30 23:22:26

    神题

  • @ 2014-10-30 23:08:29

    这玩意有啥意义吗……

  • @ 2014-10-30 00:55:26
    • @ 2014-10-30 23:23:58

      头像是啥?

    • @ 2014-11-01 21:54:36

      那个。。。。维基上面的呢没有完全按照原则。。。只输出了一段。。。不科学。。。有木有严格按照原则的???

  • @ 2014-10-29 22:46:20

    Quine

    • @ 2014-10-29 22:55:48

      什么意思???

    • @ 2014-10-30 00:52:33

      你google看看0 0

    • @ 2014-10-30 00:52:56

      A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

    • @ 2014-10-30 17:02:36

      有C++代码吗????

  • @ 2014-10-29 22:41:48

    *******有木有人做出来呀*****

  • 1