☆──────────────────────────────────────☆
MyApple (温柔好男人|乃粉) 于 2007年10月26日11:55:30 星期五 提到:
google一下,竟然是ACM的题目
早知道应该常来算法版逛,多做ACM题目了
呜呜呜
☆──────────────────────────────────────☆
basic (basic) 于 2007年10月26日16:17:42 星期五 提到:
acm会有这种题?
☆──────────────────────────────────────☆
dragondevil (潜龙在渊) 于 2007年10月26日17:15:01 星期五 提到:
有发过,作为趣味题
☆──────────────────────────────────────☆
Lovesisi (st囧 .-+-囍-+-. 囧rz) 于 2007年10月26日18:14:58 星期五 提到:
不限语言的话,
#!/bin/bash
cat $0
当然只能在*nix下面运行
☆──────────────────────────────────────☆
fzk (幻之鎧) 于 2007年10月26日18:40:43 星期五 提到:
这是个很经典的题目,可以看看Thompson拿图灵奖时的演讲。
国内有个oj搞过这样的题,
不过acm比赛没有这样的题。
☆──────────────────────────────────────☆
wbq (海滩拾贝) 于 2007年10月26日22:45:29 星期五 提到:
C/C++ CODE:
#include <stdio.h>
char *a="#include <stdio.h>%c%cchar *a=%c%s%c;%c%cint main(){printf
(a,13,10,34,a,34,13,10); return 0;}";
int main(){printf(a,13,10,34,a,34,13,10); return 0;}
能解释下13,10,34有什么作用么?
☆──────────────────────────────────────?
sai (bbs是毒品) 于 2007年10月27日09:21:37 星期六 提到:
貌似是引号和回车的ascill码
☆──────────────────────────────────────?
winsty (winsty) 于 2007年10月29日13:07:32 星期一 提到:
【 在 MyApple 的大作中提到: 】
: google一下,竟然是ACM的题目
: 早知道应该常来算法版逛,多做ACM题目了
:
: 呜呜呜
是原来TongJi上面的
面试出这题 也可见这公司很无聊了
☆──────────────────────────────────────?
basic (basic) 于 2007年10月29日13:09:52 星期一 提到:
要是我答这道题,我会毫不犹豫的写:
tooooold
【 在 winsty (winsty) 的大作中提到: 】
:
:
:
: 是原来TongJi上面的
: 面试出这题 也可见这公司很无聊了
☆──────────────────────────────────────?
dudu (9700~嘟嘟) 于 2007年10月29日13:16:53 星期一 提到:
直接system一个cat源文件,娃哈哈
【 在 basic (basic) 的大作中提到: 】
: 要是我答这道题,我会毫不犹豫的写:
: tooooold
☆──────────────────────────────────────
windywinter (WindyWinter) 于 2007年11月06日00:45:40 星期二 提到:
【 在 wbq 的大作中提到: 】
:
: C/C++ CODE:
: #include <stdio.h>
: char *a="#include <stdio.h>%c%cchar *a=%c%s%c;%c%cint main(){printf
: (a,13,10,34,a,34,13,10); return 0;}";
: int main(){printf(a,13,10,34,a,34,13,10); return 0;}
: 能解释下13,10,34有什么作用么?
这个代码是平台相关的,win平台下用连续两个字符ASC10和ASC13表示换行,而在*uix平台
下用ASC10表示换行,在Mac平台下用ASC13表示换行。
我凑了40多分钟,终于凑到一个大约是平台无关的了。
#include <stdio.h>
int main(){char *a="int main(){char *a=%c%s%c;printf(%c#include
<stdio.h>%cn%c);printf(a,34,a,34,34,92,34,34,92,34);printf(%c%cn%c);return
0;}";printf("#include
<stdio.h>/n");printf(a,34,a,34,34,92,34,34,92,34);printf("/n");return 0;}
☆──────────────────────────────────────
dragondevil (潜龙在渊) 于 2007年11月06日09:16:04 星期二 提到:
仍然很strong
【 在 windywinter 的大作中提到: 】
:
: 这个代码是平台相关的,win平台下用连续两个字符ASC10和ASC13表示换行,而在*uix平
台
: 下用ASC10表示换行,在Mac平台下用ASC13表示换行。
: 我凑了40多分钟,终于凑到一个大约是平台无关的了。
: #include <stdio.h>
: int main(){char *a="int main(){char *a=%c%s%c;printf(%c#include
: <stdio.h>%cn%c);printf(a,34,a,34,34,92,34,34,92,34);printf(%c%cn%c);return
: 0;}";printf("#include
: <stdio.h>/n");printf(a,34,a,34,34,92,34,34,92,34);printf("/n");return 0;}
☆──────────────────────────────────────
phunter (程式猎人:9区"我的野? 于 2007年11月06日09:47:48 星期二 提到:
这种公司不去也罢
: 仍然很strong
: 台