刚才看到一条有意思的微博:
程序员的新年祝福:1024 + 512 + 256 + 128 + 64 + 16 + 8 + 4 + 2 + 1 = 2015
于是稍微想一下就翻译成python代码了:
sum([2**i for i in range(0, 11) if i!=5])
以上就作为抛砖引玉,有兴趣的话大家用自己熟悉的语言写出2015吧。
1
honeyshine75 2015-01-01 20:42:23 +08:00
2015
|
2
orvice 2015-01-01 20:42:28 +08:00
<h1>2015</h1>
|
3
honeyshine75 2015-01-01 20:42:56 +08:00
<?php
2015 ?> |
4
tatsuteng 2015-01-01 20:47:23 +08:00 1
二零一五 - -
|
5
crazyxin1988 2015-01-01 20:48:32 +08:00
print “2015”
|
6
Yien 2015-01-01 20:49:18 +08:00 via iPhone
echo 2015
|
7
orvice 2015-01-01 20:50:16 +08:00
@honeyshine75 这样不会出错嘛- -
|
8
yesmeck 2015-01-01 20:52:22 +08:00 1
Happy = Time
Happy.new.year |
9
blacktulip 2015-01-01 20:54:33 +08:00
不美,少了 32
|
10
messyidea 2015-01-01 20:58:47 +08:00 via Android
puts(“2015”)
|
11
nilennoct 2015-01-01 20:59:14 +08:00 via iPad
(function(exp){var sum=x=1;while(exp-->0){sum+=(x<<=1,exp==5?0:x);}return sum;})(10);
|
12
bellchu 2015-01-01 20:59:32 +08:00
11111011111
|
13
lvfujun 2015-01-01 21:00:55 +08:00
<?php
echo 2015; ?> |
14
lvfujun 2015-01-01 21:01:22 +08:00
<script>document.wirte('2015')</script>
|
15
873681136 2015-01-01 21:01:45 +08:00
printf("2015");
|
16
evlos 2015-01-01 21:01:46 +08:00
System.out.println("2015"); //最近写 Bukkit 插件 Java 写多了。。。
|
17
lvfujun 2015-01-01 21:02:02 +08:00
0x7DF
|
18
cismous 2015-01-01 21:02:14 +08:00
F12
console.log(2015); |
19
lvfujun 2015-01-01 21:02:17 +08:00
03737
|
20
pagecho 2015-01-01 21:03:26 +08:00
二〇一五
|
21
harmy OP base64和汇编还没出现 :)
|
22
Hashell 2015-01-01 21:10:12 +08:00
<style>
.reply_content:after{content:"\32\30\31\35";} </style> |
23
Septembers 2015-01-01 21:10:25 +08:00 1
JavaScript: "ߟ".charCodeAt(0)
Python/PHP: ord("ߟ") |
24
jkjoke 2015-01-01 21:10:33 +08:00
cout<<2015
|
25
Xiaobaixiao 2015-01-01 21:12:30 +08:00
two zero one five
|
26
honeyshine75 2015-01-01 21:36:44 +08:00
@orvice 哦哦 ,我是业余的,嘿嘿 echo 2015
|
27
Mac 2015-01-01 21:38:49 +08:00
10 LET A=2015
20 PRINT A 30 END |
28
bian 2015-01-01 21:43:12 +08:00
(display 2015)
|
29
orancho 2015-01-01 21:44:24 +08:00
def happy(newyear)
n = 0 2015.time { n = n +1 } puts n.to_s end happy "new year!" |
30
orancho 2015-01-01 21:45:12 +08:00
啊,少打一个's'
def happy(newyear) n = 0 2015.times { n = n +1 } puts n.to_s end happy "new year!" |
31
760974873 2015-01-01 21:46:55 +08:00
2015
|
33
messyidea 2015-01-01 21:52:57 +08:00 1
brainfuck :D
++++++++++++++++++++++++++++++++++++++++++++++++++.--.+.++++. |
34
joshryo 2015-01-01 21:54:52 +08:00 1
MjAxNQ==
|
35
loveuqian 2015-01-01 21:55:01 +08:00
那我只好<title>2 0 1 5</title>咯
|
36
NewYear 2015-01-01 22:01:45 +08:00
dos
echo 2015 |
37
mimzy 2015-01-01 22:04:50 +08:00
Console.WriteLine(2015);
|
38
frankenstein 2015-01-01 22:08:24 +08:00
贰零壹伍
|
39
frankenstein 2015-01-01 22:10:27 +08:00
..--- ----- .---- .....
|
40
hjc4869 2015-01-01 22:12:51 +08:00
2015年(にせんじゅうごねん)
|
41
wusibacg 2015-01-01 22:14:53 +08:00
printf("2015\n");
|
42
icedx 2015-01-01 22:25:25 +08:00
print int('2015')
|
43
liuchang0812 2015-01-01 22:26:31 +08:00
1 to 11 filter( _ != 5) map( pow(2, _) )
|
44
zhsso 2015-01-01 22:28:40 +08:00 via iPad
2015
|
45
liuchang0812 2015-01-01 22:29:54 +08:00
0 to 10 filter (_!=5) map ( pow(2, _)) reduce (_+_)
|
46
AnotherM 2015-01-01 22:30:47 +08:00 via Android
#include<stdio.h>
int main() { int a,b=2; for(a=0;a<=8;a++) b=b*2; b+=b; b=b-33; printf("%dHappy New Year\n",b); } |
47
wuzhou69 2015-01-01 22:34:09 +08:00
Две тысячи пятнадцать
|
48
alex321 2015-01-01 22:36:03 +08:00
// php
<?php echo '2015'; // javascript console.log('2015'); // html 2015 // C# using System.Web; … Response.Write("2015"); … |
49
bingu 2015-01-01 22:40:45 +08:00
@honeyshine75 呵呵
|
50
oz 2015-01-01 22:41:32 +08:00
दो शून्य से एक पाँच
|
51
Dibel 2015-01-01 22:44:22 +08:00
(define (loop count)
(define (iter val n) (cond ((= n -1) val) ((= n 5) (iter val (- n 1))) (else (iter (+ val (expt 2 n)) (- n 1))))) (iter 0 count)) (display (loop 10)) |
52
chinafeng 2015-01-01 22:47:31 +08:00
好像还没有易语言,补充下
调试输出("2015") |
53
zangbob 2015-01-01 22:48:12 +08:00
<h1>2015</h1>被人抢了,<title>2015</title>也被人抢了。。。
那我只能<strong>2015</strong>了。。 |
54
bingu 2015-01-01 22:48:43 +08:00
package main
import "fmt" func main() { fmt.Println( "2015" ) } |
55
loolac 2015-01-01 22:49:57 +08:00
2014+1 = 2015
|
56
LINAICAI 2015-01-01 22:51:31 +08:00
NSLog(@"2015");
|
57
Tink 2015-01-01 22:53:52 +08:00 via iPhone
echo 2015
|
58
Lentin 2015-01-01 22:56:40 +08:00 via Android
Two Zero One Five
|
59
neilp 2015-01-01 22:59:55 +08:00
贰零壹伍
我就会这个了. |
60
hooozer 2015-01-01 23:04:00 +08:00
p "2015"
|
61
Registering 2015-01-01 23:04:40 +08:00
ri leng yi ou ------我的母语,潮汕话
|
62
jiang42 2015-01-01 23:05:18 +08:00
Haskell:
sum [2^x | x <- [0..10], x /= 5] |
63
igboy 2015-01-01 23:09:14 +08:00
425887a717c43508
65d2ea03425887a717c435081cfc5dbb 9cdda67ded3f25811728276cefa76b80913b4c54 |
64
Monad 2015-01-01 23:18:00 +08:00 via iPhone
召唤Erlang
|
65
njutree 2015-01-01 23:18:44 +08:00
fmt.Println("2015")
|
66
skylooker 2015-01-01 23:27:08 +08:00
#第一种
puts '2015' ---华丽的分隔符--- //第二种 var x="2015"; console.log(x); ---华丽的分隔符--- <!-- 第三种 --> <h1>2015</h1> |
67
endoffight 2015-01-01 23:28:07 +08:00
#!/usr/bin/env bash
echo 2015 |
68
roychan 2015-01-01 23:33:20 +08:00
二零一五
|
69
jarhom 2015-01-01 23:38:19 +08:00
iphone6/plus
|
70
musics 2015-01-01 23:44:59 +08:00
data segment
output db 'Hello 2015! $' data ends code segment start: assume ds:data,cs:code mov ax,data mov ds,ax mov dx,offset output mov ah,09h int 21h mov ah,4ch int 21h code ends end start |
71
adeweb 2015-01-01 23:54:43 +08:00
..--- ----- .---- .....
|
72
yangqi 2015-01-01 23:55:22 +08:00 1
אלפיים וחמש עשרה
|
73
726332269 2015-01-01 23:56:09 +08:00 via Android
echo '2015'
|
74
jylee 2015-01-01 23:57:28 +08:00
ji ling jat ng
|
75
lilydjwg 2015-01-02 00:06:16 +08:00
sum $ map (2^) $ [0..4]++[6..10]
|
76
lilydjwg 2015-01-02 00:21:49 +08:00
use std::iter::AdditiveIterator;
use std::num::Int; fn main() { let year: int = range(0,5).chain(range(6,11)).map(|x| 2.pow(x)).sum(); println!("Happy year {}!", year); } // 开头那两行 use 好讨厌啊…… |
77
TomDu 2015-01-02 00:46:01 +08:00
cout << "2015";
System.out.println("2015"); print "2015"; |
78
orzfly 2015-01-02 00:46:30 +08:00
|
79
Chipper 2015-01-02 00:46:48 +08:00
二零一五
|
80
sneezry 2015-01-02 00:51:33 +08:00
MOV BX, 2015
|
81
Yvette 2015-01-02 01:27:31 +08:00
year=2015;
disp(year) |
82
ck65 2015-01-02 01:34:40 +08:00 via iPhone
Dos mil quince
|
83
Yvette 2015-01-02 01:35:12 +08:00
按楼主的算法
for i=10:-1:0 a(i+1)=2^(10-i); end a(6)=0; fprintf('Happy New Year, %i',sum(a)) |
84
byfan 2015-01-02 01:36:07 +08:00 via iPhone
<p>2015</p>
|
85
wolfan 2015-01-02 02:11:54 +08:00 via Android
body{width:2015;}
|
86
laotaitai 2015-01-02 02:54:38 +08:00
输出 2015
|
87
fx 2015-01-02 02:56:42 +08:00
```
0..10 |> Enum.filter_map(&(&1!=5), &(:math.pow(2, &1))) |> Enum.sum ``` |
88
baichi 2015-01-02 03:15:42 +08:00
佛曰:離闍冥藐婆梵他奢集殿知冥麼哆醯帝冥有喝朋阿耨
|
89
kawaiiushio 2015-01-02 04:06:59 +08:00
</2014><2015>
|
90
infinte 2015-01-02 04:52:41 +08:00
console.log '2015'
// 这是 patel |
91
lm902 2015-01-02 05:02:43 +08:00
@{var year = 2015.ToString();}
<h1>@year</h1> |
92
Ricepig 2015-01-02 06:52:49 +08:00
PRINT 2015
|
93
cassyfar 2015-01-02 06:55:18 +08:00
year = 0;
for (int i=0; i<11; i++) year += (1<<i); cout<<(year-32)<<endl; |
94
jooe 2015-01-02 07:10:45 +08:00 via Android
$ 2015
|
95
DaCong 2015-01-02 07:37:55 +08:00
begin
write(2015) end. |
96
cxshun 2015-01-02 09:02:41 +08:00
print(2015)
|
97
notcome 2015-01-02 09:09:10 +08:00
length [0..2014]
|
98
ai0by 2015-01-02 09:14:51 +08:00 via Android
print '2015'
|
99
Jiangtaigong 2015-01-02 09:18:47 +08:00
@)!%
(shift 2015) |