【官方比赛】社区 1111 秀代码,让你来秀让你飞!

又是一年光棍节,你是成功脱单了,还是继续在做单身汪?

都没关系!SegmentFault 特此推出官方比赛「社区 1111 秀代码」活动,让你来秀让你飞!

规则很简单:

  1. 无论语言形式,无论代码多少,以自己认为最优的方式,最雅地输出 1111 或者光棍节相关内容
  2. 比赛时间三天,11 月 10 日开始,11 月 13 日早上 10 点截止
  3. 你也可以简短的给自己的作品设计一下标语,或者简单阐述你的创意。
  4. 评比标准是社区小伙伴们的投票数,最终得票最高前三名用户将分别获得 SegmentFault 特递 IKBC PokerII 机械键盘(大管家同款),前五名将获得 SegmentFault 的纪念 T恤

至于代码呢,可以像这样

# language: python - 首行注明所用语言

print '1111'

也可以这样

// language: javascript

function(){
    return new girl();
}

更甚者

/**
 * language: 面向对象的伪代码
 * author: @Integ
 * contact me if you're running a big plan @ 11/11.
 **/

class 单身狗 {
    age   = 26;
    money = 0;
    house = 0;
    car   = 0; 
    energy = 99;
    dream  = 99;
    public 逆袭() {
        this.dream  = 'come true';
        print '走上人生巅峰!';
    }
    public 变基() {
        energy = 999;
        print '异性只为繁殖,同性才是真爱!';
    }
}
if date == '11.11'
   try {
       单身狗.逆袭();
   } catch(e) {
       单身狗.变基();
   }



你还在等什么呢?让思维和键盘都飞起来吧!

1111


2014.11.13 更新:

目前的前五名依次是:@苏生不惑 @justjavac @公子 @mcfog @animabear ,前三位每人将得到 @fenbox 同款机械键盘一副,同时这五位都将获得 SegmentFault T恤一件!

阅读 9.5k
评论
    48 个回答
    // language: javascript
    // 打开控制台运行,亲
    Function("‍‍‌‍‍‌‍‍‍‍‌‍‌‍‍‍‍‍‌‍‍‍‌‍‍‍‌‍‌‌‌‍‍‌‌‌‍‌‌‌‍‌‌‍‌‍‍‌‍‌‌‍‍‌‍‍‍‌‌‍‍‌‌‌‍‌‌‍‍‌‍‌‍‌‌‌‍‌‍‍‍‍‌‍‌‌‍‌‍‌‌‌‍‌‌‍‍‌‌‍‌‌‌‌‍‌‌‌‍‌‍‍‍‌‌‍‍‌‍‌‍‍‌‍‍‍‍‍‍‍‌‍‌‌‌‍‍‌‌‍‌‌‍‍‍‌‌‍‌‍‍‌‍‌‌‍‌‍‌‌‍‌‌‍‍‌‍‌‍‌‍‌‌‍‌‌‍‌‌‍‍‌‍‍‍‌‌‍‍‍‍‌‍‌‌‌‍‌‍‍‍‌‌‍‍‍‍‌‍‍‌‍‌‌‍‌‍‌‌‍‌‍‍‌‍‌‌‍‍‌‍‍‍‍‌‌‌‌‍‌‍‌‍‌‌‌‍‍‍‍‌‍‍‍‌‍‍‍‌‌‍‍‍‌‍‍‌‌‍‍‍‍‍‍‌‌‍‍‌‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‍‌‌‍‌‌‌‍‍‌‌‍‌‌‍‍‍‌‌‍‌‌‌‍‍‌‌‍‌‌‍‍‍‌‌‍‍‌‍‍‍‌‌‍‍‍‌‍‌‍‌‌‌‍‍‍‍‌‍‍‍‌‍‍‌‍‌‌‌‍‌‍‍‌‍‍‍‌‍‍‍‌‍‌‍‍‌‍‍‌‍‌‌‌‍‍‌‌‍‍‍‌‌‍‌‌‍‌‌‍‍‍‌‌‍‌‍‍‌‍‌‌‍‍‍‌‌‍‌‌‍‌‍‌‌‍‍‌‍‌‍‍‍‍‍‌‍‌‍‍‌‍‍‌‍‌‌‍‍‍‌‌‍‍‍‌‌‍‌‌‍‌‌‌‌‍‌‌‍‌‌‌‍‍‌‌‌‍‍‌‌‍‌‌‍‌‌‌‌‍‌‌‍‌‌‍‍‍‌‌‍‍‌‍‌‍‍‌‍‌‌‌‍‍‌‌‍‌‌‍‍‍‌‌‍‌‌‌‌‍‌‌‍‍‌‌‌‍‍‌‍‌‍‍‍‍‍‌‍‍‍‌‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‌‍‍‌‌‌‍‍‌‍‍‌‌‍‌‌‌‍‍‌‌‍‍‌‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‌‌‍‍‌‌‌‍‍‌‍‍‌‌‍‌‍‌‍‌‌‍‍‌‍‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‌‍‍‍‍‌‌‍‍‌‌‍‍‌‌‍‍‌‍‍‍‍‌‌‌‍‍‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‌‍‍‍‌‌‍‌‌‍‍‍‌‌‍‍‌‍‍‌‌‍‍‌‌‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‌‍‍‍‍‍‌‌‌‍‍‌‍‍‌‌‌‍‍‍‍‍‌‌‍‍‍‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‌‍‍‍‍‌‌‍‍‌‌‍‍‌‌‍‍‌‌‍‍‌‌‍‍‌‍‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‌‌‍‍‌‌‍‌‌‍‍‍‌‌‌‍‍‍‍‍‌‌‍‌‍‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‌‌‍‍‌‌‍‍‌‌‍‍‌‌‍‍‍‌‌‍‍‍‍‍‌‌‍‍‍‌‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‍‍‌‌‍‍‌‍‌‍‍‌‌‍‍‍‍‍‍‌‌‍‌‌‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‍‍‌‌‍‍‌‍‌‍‍‌‌‍‍‍‍‍‍‌‌‍‍‍‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‌‍‍‌‌‌‍‍‌‍‍‌‌‍‌‌‌‍‍‌‌‌‍‍‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‌‌‍‍‌‌‍‌‌‌‍‍‌‌‌‍‍‍‍‌‌‍‍‌‍‌‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‍‍‌‌‍‍‌‍‌‍‍‌‌‌‍‍‍‍‍‌‌‍‌‌‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‍‌‌‍‌‍‌‍‍‌‌‍‌‍‍‍‍‌‌‍‌‌‍‍‍‌‌‍‍‌‍‍‌‍‌‌‌‍‍‍‌‌‌‍‌‍‌‍‌‌‍‍‌‌‍‍‌‌‍‍‌‌‍‍‍‌‌‍‍‍‍‍‌‌‍‍‍‌‌‍‍‌‍‍‍‌‍‍‍‌‍‌‍‍‌‍‍‌‌‌‍‌‌".replace(/.{8}/g,function(u){return String.fromCharCode(parseInt(u.replace(/\u200c/g,1).replace(/\u200d/g,0),2))}))();
    
      • 47.1k

      先用下面的代码占个坑,一会儿再答(这是一段神奇的代码):

      document.querySelector("button[data-id=\"1020000000767695\"][class=\"like\"]").click();
      

      脱光不现实,让这段代码陪陪你:

      /* via https://github.com/pa7/nude.js */
      nude.scan(callback)
      

      不知道作者为什么这么羞涩,没有提供文档,也没有写明详细的注释。

      这是一个很神秘的库,提供了一个神秘的函数,实现了一个神秘的功能——

      扫描网页的图片,判断是不是裸体(摔,看你们谁还敢脱光)

      今年光棍节,可以用这段代码陪陪你。可以去看看官方的 demo。

      记住这段神秘的代码 nude.scan(callback)

      --------- ↓↓↓↓下面代码废了↓↓↓↓ ------------

      字符码那个去年已经玩了2次了,今天来个简单的,就不炫技了。

      将你QQ号中间插入 + - * /,计算结果和 1+1+1+1 比较。

      没有B格,没有技巧,没有眼花缭乱,只有一个变量 op_diaobaolity,多读几遍就知道什么意思了。

      现在问题来了,op_diaobaolity = parseInt(i).toString(4) 这段代码什么意思呢?

      var no = "123456789";   // 此处填写你的QQ号码
      var ops = ["+", "-", "*", "/"];
      
      var expression = [];
      
      var total = 0;
      
      for (var i=0; i<Math.pow(4, no.length-1); i++) {
          var op_diaobaolity = parseInt(i).toString(4);
          var exp = no[0];
          for (var j=1; j<no.length; j++) {
              var op_index = op_diaobaolity[no.length-j] | 0;
              exp += ops[op_index] + no[j];
          }
      
          if (eval(exp) == 4) {
              total ++;
              console.log(exp + "=1+1+1+1");
          }
      }
      
      console.log("今年双十一的脱光概率:" + (total/365*100).toFixed(2) + "%");
      
        • 36.4k
        //language: javascript
        var 情人节 = 214, 七夕 =  77,  
            猜疑 = 妒忌 = 隐瞒 = true,
            承诺 = true;
        
        光棍节 = ((情人节 - 七夕)<<猜疑<<妒忌<<隐瞒) + ((承诺<<承诺<<承诺<<承诺<<承诺) - 承诺);
        

        这个代码的寓意就是:虽然现在你可能成双成对,但是如果你们两个人在一起的时候充满了猜疑、妒忌、隐瞒,不管你们相互之前许下了多少个无法信任的承诺,不管你们度过了多少个情人节,多少个七夕,光棍节终将等待着你们。

          • 21.9k
          //javascript; chrome only
          ゚ω゚ノ= /`m´)ノ ~┻━┻   //*´∇`*/ ['_']; o=(゚ー゚)  =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (o^_^o)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (c^_^o)+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((o^_^o) +(o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((o^_^o) +(o^_^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (c^_^o)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (o^_^o))+ (o^_^o)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('_');
          

          解释一下

          a) 颜文字编码 http://utf-8.jp/public/aaencode.html
          b) chrome的console.log 支持嵌入CSS google文档(墙外),封装过的console.image
          c) 源代码 @咪蛾 已经贴了

          console.log("%c+", "background: url(http://sfault-image.b0.upaiyun.com/276/384/2763848260-54604b154d720_articlex) no-repeat;background-size:511px 271px;padding: 135px 255px;font-size: 1px;color:transparent;line-height:271px;");
          

          这类编码的解码主要靠断点,比如这里很明显用到了console.log,可以注入console.log来拿断点

          console.log=function(){debugger;}
          

          然后粘入原文执行后,通过callstack就能看到源代码
          图片描述

            你们能感受到我满满的怨念么!!! (去控制台运行吧,接受我五彩缤纷的诅咒吧!!)

            加了动效,打出1111个11.11,这下怨念够足吧

            之前的版本直接删了,没图说个JB,有密集恐惧症的请绕开。

            图片描述

            var ihtml = '<canvas id="myCanvas" width="' + document.body.clientWidth + '" height="' + document.body.clientHeight + '" style="position: fixed; left: 0; top: 0; z-index: 9999; background-color: rgba(0, 0, 0, 0.6);"></canvas>', fg = document.createElement('div');
            fg.innerHTML = ihtml;
            document.body.appendChild(fg);
            var ctx = document.getElementById('myCanvas').getContext('2d');
            ctx.clearRect(0, 0, document.body.clientWidth, document.body.clientHeight);
            ctx.font = '60px arial'; ctx.textAlign = 'center';
            var i = 0, sid = 0, len = 1111;
            var render = function() {
                i++;
                if (i > len) {clearTimeout(sid); return false;} 
                ctx.save();
                ctx.fillStyle = '#' +(~~(Math.random()*(1<<24))).toString(16);
                ctx.fillText('11.11', Math.floor(Math.random() * (document.body.clientWidth + 1)), Math.floor(Math.random() * (document.documentElement.clientHeight + 1)));
                ctx.restore();
                sid = setTimeout(render, 50);
            }
            render();
            

              在线预览:http://3v4l.org/4UP8C

              <?php
              
              #   language : php
              
              $eleven = <<<EOF
              
              <pre>  
                 _           _               _           _              
                / /\        / /\            / /\        / /\            
               / /  \      / /  \          / /  \      / /  \           
              /_/ /\ \    /_/ /\ \        /_/ /\ \    /_/ /\ \          
              \_\/\ \ \   \_\/\ \ \       \_\/\ \ \   \_\/\ \ \         
                   \ \ \       \ \ \           \ \ \       \ \ \        
                    \ \ \       \ \ \           \ \ \       \ \ \       
                     \ \ \       \ \ \           \ \ \       \ \ \      
                    __\ \ \___  __\ \ \___  _   __\ \ \___  __\ \ \___  
                   /___\_\/__/\/___\_\/__/\/\_\/___\_\/__/\/___\_\/__/\ 
                   \_________\/\_________\/\/_/\_________\/\_________\/ 
              </pre>  
              
              EOF;
              
              echo $eleven;
              

                这是一个魔兽世界插件。

                首先 我们建立一个变量

                --lang: lua
                local Yike  = mod:SoundMM("SoundWOP")
                

                然后我们搞一搞插件的配置文件。可以在里面放一点字符串什么的。

                ## Interface: 60000
                ## X-Min-Interface: 60000
                ## Title:|cffffe00a<|r|cffff7d0aDBM|r|cffffe00a>|r |cff69ccf0Sound-Yike|r
                ## DefaultState: enabled
                ## RequiredDeps: DBM-Core
                ## Author: Yike Xia, Mini_Dragon
                ## Notes: 还是要去向女神表白的, 万一女神瞎了呢?
                ## Version: 14.11.10
                

                然后。

                图片描述

                该字符串将在48小时内向全国几十万魔兽世界玩家推送

                  //language: Swift
                  
                  /*
                  -------------------------------
                  标题:茫茫人海 终于等到你
                  作者:CallMeWhy
                  -------------------------------
                  */
                  
                  
                  
                  // 前言 - 这个世界充满秘密
                  import UIKit
                  
                  // 我们是彼此独立的个体
                  class Person {
                  
                      // 有人住在心头 有人住在心里
                      var lover: Person?
                  
                      // 有人一生了无牵挂
                      init(){
                          lover = nil
                      }
                  
                      // 有人心中始终有你
                      init(lover: Person) {
                          self.lover = lover
                      }
                  }
                  
                  
                  // 彼时场景 依旧清晰
                  var you = Person()
                  
                  // 一生挚爱 此生唯一
                  let me  = Person(lover:you)
                  
                  
                  // 有时我常常在想 茫茫人海 为何偏遇上你
                  var world = Array(count: 1111, repeatedValue: Person())
                  
                  // 缘分是有些神奇 看似随机 让人不能自已
                  world.insert(you, atIndex: Int(arc4random()) % 1111 )
                  
                  
                  // 我把整个世界遍历
                  for person in world {
                  
                      // 只为有一天 能够早点等到你
                      if person === you {
                  
                          // 执子之手 不离不弃 白头偕老 相偎相依
                          you.lover = me
                  
                          // 永远在一起
                          println("11.11")
                      }
                  }
                  
                  // 我的爱 双十一 都充在了 支付宝钱包里
                  // 怎么花 随便你 不论多少 老子都付得起
                  
                  
                    • 5
                    • 新人请关照

                      来个函数图像的吧,首先运行下面的程序

                      # language: python
                      import math
                      import pickle
                      
                      f = pickle.loads('(lp0 c__builtin__ complex p1 (F0.0 F0.0 tp2 Rp3 ag1 (F0.5 F0.0 tp4 Rp5 ag1 (F0.5 F3.0 tp6 Rp7 ag1 (F0.0 F2.5 tp8 Rp9 ag1 (F0.0 F3.0 tp10 Rp11 ag1 (F0.5 F3.5 tp12 Rp13 ag1 (F1.5 F3.5 tp14 Rp15 ag1 (F1.5 F0.0 tp16 Rp17 ag1 (F2.5 F0.0 tp18 Rp19 ag1 (F2.5 F3.0 tp20 Rp21 ag1 (F2.0 F2.5 tp22 Rp23 ag1 (F2.0 F3.0 tp24 Rp25 ag1 (F2.5 F3.5 tp26 Rp27 ag1 (F3.5 F3.5 tp28 Rp29 ag1 (F3.5 F0.0 tp30 Rp31 ag1 (F4.5 F0.0 tp32 Rp33 ag1 (F4.5 F3.0 tp34 Rp35 ag1 (F4.0 F2.5 tp36 Rp37 ag1 (F4.0 F3.0 tp38 Rp39 ag1 (F4.5 F3.5 tp40 Rp41 ag1 (F5.5 F3.5 tp42 Rp43 ag1 (F5.5 F0.0 tp44 Rp45 ag1 (F6.5 F0.0 tp46 Rp47 ag1 (F6.5 F3.0 tp48 Rp49 ag1 (F6.0 F2.5 tp50 Rp51 ag1 (F6.0 F3.0 tp52 Rp53 ag1 (F6.5 F3.5 tp54 Rp55 ag1 (F7.5 F3.5 tp56 Rp57 ag1 (F7.5 F0.0 tp58 Rp59 ag1 (F8.0 F0.0 tp60 Rp61 a.'.replace(' ', '\n'))
                      
                      N = len(f)
                      
                      F = []
                      for i in range(N):
                          ang = -2 * 1j * math.pi * i / N
                          r = 0
                          for j in range(N):
                              r += (math.e ** (ang * j)) * f[j]
                          F.append(r)
                      
                      print "set parametric"
                      print "set samples", N + 1
                      
                      print "x(t)=",
                      for i in range(N):
                          ang = 2 * math.pi * i / N
                          if i > 0:
                              print "+",
                          print F[i].real / N, "*cos(", ang, "*t)-",
                          print F[i].imag / N, "*sin(", ang, "*t)",
                      
                      print
                      print "y(t)=",
                      for i in range(N):
                          ang = 2 * math.pi * i / N
                          if i > 0:
                              print "+",
                          print F[i].imag / N, "*cos(", ang, "*t)+",
                          print F[i].real / N, "*sin(", ang, "*t)",
                      
                      print
                      print "plot [t=0:", N, "] x(t), y(t)"
                      print "pause 60"
                      

                      你会得到像这样的函数

                      x(t)= 3.66666666667 *cos( 0.0 *t)- 2.06666666667 *sin( 0.0 *t) + -0.105011723716 *cos( 0.209439510239 *t)- 1.202834772 *sin( 0.209439510239 *t) + -0.0825410980825 *cos( 0.418879020479 *t)- 0.492711836248 *sin( 0.418879020479 *t) + -0.0352296390286 *cos( 0.628318530718 *t)- 0.198569365328 *sin( 0.628318530718 *t) + 0.27861428437 *cos( 0.837758040957 *t)- -0.402189335212 *sin( 0.837758040957 *t) + -0.247767090063 *cos( 1.0471975512 *t)- 0.377072594216 *sin( 1.0471975512 *t) + -0.132285878304 *cos( 1.25663706144 *t)- 0.169680414694 *sin( 1.25663706144 *t) + -0.0598092899154 *cos( 1.46607657168 *t)- 0.0632624353922 *sin( 1.46607657168 *t) + 0.145004949207 *cos( 1.67551608191 *t)- -0.125368987997 *sin( 1.67551608191 *t) + -0.521419392061 *cos( 1.88495559215 *t)- 0.363529040202 *sin( 1.88495559215 *t) + -0.234369630442 *cos( 2.09439510239 *t)- 0.128269207045 *sin( 2.09439510239 *t) + -0.169021775285 *cos( 2.30383461263 *t)- 0.0683346020549 *sin( 2.30383461263 *t) + -0.11414058381 *cos( 2.51327412287 *t)- 0.025668257918 *sin( 2.51327412287 *t) + -0.436218263366 *cos( 2.72271363311 *t)- 0.146489206425 *sin( 2.72271363311 *t) + -0.164935731998 *cos( 2.93215314335 *t)- 0.0217592426598 *sin( 2.93215314335 *t) + -0.133333333333 *cos( 3.14159265359 *t)- -2.44348024414e-15 *sin( 3.14159265359 *t) + -0.108013689333 *cos( 3.35103216383 *t)- -0.0156912873844 *sin( 3.35103216383 *t) + 0.0358940284623 *cos( 3.56047167407 *t)- -0.0368128817506 *sin( 3.56047167407 *t) + -0.121624383419 *cos( 3.76991118431 *t)- -0.0359688243972 *sin( 3.76991118431 *t) + -0.0855632633805 *cos( 3.97935069455 *t)- -0.0448090472623 *sin( 3.97935069455 *t) + -0.0322970362251 *cos( 4.18879020479 *t)- -0.0449358737118 *sin( 4.18879020479 *t) + 0.240517692623 *cos( 4.39822971503 *t)- 0.0233839888185 *sin( 4.39822971503 *t) + -0.434886395167 *cos( 4.60766922527 *t)- -0.201422448514 *sin( 4.60766922527 *t) + -0.251669874055 *cos( 4.8171087355 *t)- -0.1572008949 *sin( 4.8171087355 *t) + -0.2152824878 *cos( 5.02654824574 *t)- -0.142713181548 *sin( 5.02654824574 *t) + -0.218899576604 *cos( 5.23598775598 *t)- -0.0270725942164 *sin( 5.23598775598 *t) + -0.0653913986217 *cos( 5.44542726622 *t)- -1.09715774927 *sin( 5.44542726622 *t) + -0.133868661534 *cos( 5.65486677646 *t)- -0.668815727682 *sin( 5.65486677646 *t) + -0.134517587041 *cos( 5.8643062867 *t)- -0.839307937196 *sin( 5.8643062867 *t) + -0.128599838743 *cos( 6.07374579694 *t)- -1.50876485863 *sin( 6.07374579694 *t)
                      y(t)= 2.06666666667 *cos( 0.0 *t)+ 3.66666666667 *sin( 0.0 *t) + 1.202834772 *cos( 0.209439510239 *t)+ -0.105011723716 *sin( 0.209439510239 *t) + 0.492711836248 *cos( 0.418879020479 *t)+ -0.0825410980825 *sin( 0.418879020479 *t) + 0.198569365328 *cos( 0.628318530718 *t)+ -0.0352296390286 *sin( 0.628318530718 *t) + -0.402189335212 *cos( 0.837758040957 *t)+ 0.27861428437 *sin( 0.837758040957 *t) + 0.377072594216 *cos( 1.0471975512 *t)+ -0.247767090063 *sin( 1.0471975512 *t) + 0.169680414694 *cos( 1.25663706144 *t)+ -0.132285878304 *sin( 1.25663706144 *t) + 0.0632624353922 *cos( 1.46607657168 *t)+ -0.0598092899154 *sin( 1.46607657168 *t) + -0.125368987997 *cos( 1.67551608191 *t)+ 0.145004949207 *sin( 1.67551608191 *t) + 0.363529040202 *cos( 1.88495559215 *t)+ -0.521419392061 *sin( 1.88495559215 *t) + 0.128269207045 *cos( 2.09439510239 *t)+ -0.234369630442 *sin( 2.09439510239 *t) + 0.0683346020549 *cos( 2.30383461263 *t)+ -0.169021775285 *sin( 2.30383461263 *t) + 0.025668257918 *cos( 2.51327412287 *t)+ -0.11414058381 *sin( 2.51327412287 *t) + 0.146489206425 *cos( 2.72271363311 *t)+ -0.436218263366 *sin( 2.72271363311 *t) + 0.0217592426598 *cos( 2.93215314335 *t)+ -0.164935731998 *sin( 2.93215314335 *t) + -2.44348024414e-15 *cos( 3.14159265359 *t)+ -0.133333333333 *sin( 3.14159265359 *t) + -0.0156912873844 *cos( 3.35103216383 *t)+ -0.108013689333 *sin( 3.35103216383 *t) + -0.0368128817506 *cos( 3.56047167407 *t)+ 0.0358940284623 *sin( 3.56047167407 *t) + -0.0359688243972 *cos( 3.76991118431 *t)+ -0.121624383419 *sin( 3.76991118431 *t) + -0.0448090472623 *cos( 3.97935069455 *t)+ -0.0855632633805 *sin( 3.97935069455 *t) + -0.0449358737118 *cos( 4.18879020479 *t)+ -0.0322970362251 *sin( 4.18879020479 *t) + 0.0233839888185 *cos( 4.39822971503 *t)+ 0.240517692623 *sin( 4.39822971503 *t) + -0.201422448514 *cos( 4.60766922527 *t)+ -0.434886395167 *sin( 4.60766922527 *t) + -0.1572008949 *cos( 4.8171087355 *t)+ -0.251669874055 *sin( 4.8171087355 *t) + -0.142713181548 *cos( 5.02654824574 *t)+ -0.2152824878 *sin( 5.02654824574 *t) + -0.0270725942164 *cos( 5.23598775598 *t)+ -0.218899576604 *sin( 5.23598775598 *t) + -1.09715774927 *cos( 5.44542726622 *t)+ -0.0653913986217 *sin( 5.44542726622 *t) + -0.668815727682 *cos( 5.65486677646 *t)+ -0.133868661534 *sin( 5.65486677646 *t) + -0.839307937196 *cos( 5.8643062867 *t)+ -0.134517587041 *sin( 5.8643062867 *t) + -1.50876485863 *cos( 6.07374579694 *t)+ -0.128599838743 *sin( 6.07374579694 *t)
                      

                      整个程序这样跑python plot.py | gnuplot
                      这样你就会看到这样的函数图像了
                      图片描述

                        • 88

                        Intro - 当冰冷如金属的 C 与火热如盛夏的情感在这个夜晚碰撞

                        近两年找到了生活的真正追求, 每天泡技术社区贴吧人人还有B站什么的, 也就没怎么写过感情相关的代码了, 不过遥想当年, 那是少不更事的大二, 当时还在单恋着高中的一位女孩... 这次为大家带来的不是什么新代码, 而是鄙人在 2011 年前后撰写的 3 段感性片段, 不知是否符合大赛要求, 不过既然主题也是与 1111 十分契合, 那么就献丑了.

                        上代码咯, 客官请慢用.

                        2011.08.13 本人校 BBS 帐号签名档

                        /* language: c */
                        
                        printf(),putchar();char*_="\217D\xd0x\x16\x81\xfc\xc0_\x86\x80H\x07}j\2078";
                        main(a,b,c){return c?main(2,0,0),printf("\n")-1:a&6?a=!b?main(1,0,0):0,b>=18
                        ?0:(a=b/3,c=b%3?(b%3-2?(1<<a&19?128:a-2?0xa0:176):(a/2<2?9-a/2:5+a)<<4):224,
                        a=_[8+b/2],c+=b%2?a&15:(unsigned char)a>>4,putchar(c),main(2,++b,0)):(b>14?0
                        :(a=b/3,c=(b%3?b%3-1?a<3?11-a%2:12-a:a?11-3*(a/2&1):10:14)<<4,a=_[b/2],c+=(b
                        %2?a&0xf:(unsigned char)a>>4),putchar(c),main(0,++b,0)));}/*xenon 20110813*/
                        
                        • 输出编码: UTF-8.
                        • 原理: 分上下各 4 位 (nibble) 组装 UTF-8 的字符, 一半数据存在数组中, 一半数据用嵌套 if 硬编码在逻辑里.

                        2011.10.17 本人校 BBS 帐号签名档

                        /* language: c */
                        
                        char*___,_;int __[]={13951232,755027660,16449783,3072};putchar();main(){for(_^=
                        _,___=__;0^_^0xe;putchar((char)(((((-0.08590534979423843)*_+2.4660493827160486)
                        *_-22.726851851851848)*_+68.30555555555554)*_+++*___+++0xbc)));;putchar(012);;}
                        /* xenon 20111017, only on little-endian arches; debugged 20111018 */
                        
                        • 输出编码: GBK
                        • 原理: 确定好要输出的字节序列之后, 用 Python 暴力解出类似这样的多项式 f(x) = ax^3 + bx^2 + cx + d 的系数 (x 为索引), 然后是一顿无脑调整加括号方式和输入范围, 将粗略拟合的误差全部控制在 char 的范围之内, 最后用数组记录下所有误差.
                        • Note: 只能在小端 (little-endian) 架构上输出预设文字, 显然是因为 int 的储存方式. 因为常见的架构如 x86_64/arm/x86/mips64el 都是 little-endian 的, 所以不用担心.

                        2012.03.28 在人人网向当时单恋对象隔空喊话的生日快乐

                        /* language: c */
                        
                        char*t,*E,*R;r=0;i=0;unsigned char e=163;g=2;o[]={518848747,350560215,42600322\
                        88,754364999,483664352,217315868,3708159976,4040030036,869862159,3743415523,23\
                        3640449,705087524,3139357982,3324767550,3810055482,851968274,3358065151,387672\
                        1652,251268841,3256088603,1832608258,3777030432,203782419,3187405824,427492266\
                        4,98587106,4722129};putchar();say(_){while(g>0){e==_?g--:0;putchar(e^(r?*--E:*
                        ++E));e-=*R++;if(!i&&R-(char*)o-1)!(E-t)?(r--,E--,i+=2):E-t-5?0:(r++,E++,i+=2);
                        i?i--:0;e-_?0:g--;}g+=2;}happy(_){say(126);}birthday(_){t=E=_;E--;R=(char*)o;
                        say(159);}main(){return happy(birthday("terrie")),0;}
                        
                        • 输出编码: GBK
                        • 原理: XOR 加密, 没什么好说的, 各种 off-by-1 bugs 从当天晚上调到凌晨 2 点 (文件 mtime 记录; 当时因为上课基本上是 0 点睡的)
                        • Note: 同样请用 little-endian 架构欣赏, 理由同上

                        结语

                        感情伤身, 我现在和 Linux, Python, Rust 过得很好, μ's 的各位这一段时间也给我无数欢乐 (我果美如画11111111), 祝各位码农能够早日找到真爱.

                        想到什么再写吧, 你们也可以在评论区来问, 研究生狗也是不容易大家点个赞呗^ ^

                          • 16.2k

                          在线预览:http://3v4l.org/CLsCp

                          //language: php
                          <?php
                          header( 'Content-Type:text/html;charset=utf-8 ');
                          echo convert_uudecode('MY8V5Z+JKYXN7YYJ$Y;^GY+RD[[R,Y+V@Y+B-YH>"(49U8VL@5&AE(#$Q+C$Q "("$` `');
                          ?>
                          
                            # language: python
                            def taobao_xx(make_money):
                                def comehere(origin_price):
                                    double_price = origin_price << 1
                                    make_money(double_price)
                                return comehere
                            
                            
                            @taobao_xx
                            def taobao_1111(origin_price):
                                half_price = origin_price >> 1
                                print half_price
                            
                            taobao_1111(1111)
                            

                            很神奇,不是吗?!

                              • 2.1k
                              //不限语言那就。。。。。阿拉伯数字也是语言噢
                                  1111 
                              //不能再每天想着代码了,女神都跑去和别人组成2222了
                              
                                • 5
                                • 新人请关照
                                #language:ruby
                                #还有比这更优雅的吗?
                                4.times { puts 1}
                                
                                  // Language: PHP
                                  
                                  class Programmer extends Monkey{
                                      $dress = array();
                                  
                                      function __construct(){
                                          $this->__init();
                                          $this->__wear();
                                      }
                                  
                                      public function __init(){
                                          $this->hair = 'sparse';
                                          $this->hasGF = FALSE;
                                      }
                                  
                                      public function __wear(){
                                          $this->dress= array(
                                              'cloth' => '冲锋衣',
                                              'trousers' => '牛仔裤',
                                              'shoes' => '运动鞋',
                                              );
                                      }
                                  
                                      public function getLove(){
                                          //TODO : 别写了,这个功能你实现不了的
                                          if(time() >= 1415635200|| time() < 1415721600){
                                              $this->surf('http://segmentfault.com');
                                          }
                                          return $this;
                                      }
                                  }
                                  $man = new Programmer();
                                  for($i=0;$i<1;$i--){
                                      $man->getLove();
                                  }
                                  
                                    • 2.5k

                                    凑个热闹

                                    #language: brainfuck
                                    +++++++++++++++++++++++++++++++++++++++++++++++++>++++[-<.>]
                                    

                                    输出

                                    1111
                                    
                                      • 686
                                      // Language: JavasScript
                                      console.log((new Date() & 15 | 15).toString(2));
                                      
                                        • 8k
                                        //Javascript
                                        console.log("1111");
                                        
                                          //language:shell
                                          echo "1111"
                                          
                                            <!--Angular-->
                                            <!doctype html>
                                            <html ng-app>
                                              <head>
                                                <title>it's up to you</title>
                                                <script src = 'http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js'></script>
                                              </head>
                                            
                                              <body ng-controller="findLove">
                                                <div ng-if = "11+11===1111">
                                                  {{mygirl}}
                                                </div> 
                                                <h3>it's up to you,just to change it rightly</h3>
                                              </body>
                                            
                                              <script type="text/javascript">
                                                function findLove($scope){          
                                                  $scope.mygirl = 'I Love You , My  Girl';
                                                };
                                              </script>
                                            </html>
                                            

                                              just happy, no matter single or not.

                                              # -*- encoding=utf-8 -*-
                                              #language: python
                                              #author: orangleliu  date:2014-11-11
                                              #title: double_11.py
                                              #python.2.7.x
                                              
                                              '''
                                              This script just has one function, print '1111'
                                              '''
                                              
                                              es = " "
                                              for i in range(10):
                                                  print es*(10-i) + '**     **     **     **'
                                              
                                              print "\n" + "*"*30 + "\n     Happy Double 11"
                                              

                                              stdout:

                                                        **     **     **     **
                                                       **     **     **     **
                                                      **     **     **     **
                                                     **     **     **     **
                                                    **     **     **     **
                                                   **     **     **     **
                                                  **     **     **     **
                                                 **     **     **     **
                                                **     **     **     **
                                               **     **     **     **
                                              
                                              ******************************
                                                   Happy Double 11
                                              
                                                • 3.4k

                                                孤独终

                                                //language:javascript
                                                var status = "单身"
                                                var age = 0
                                                var getInLove = function(){
                                                    status = "恋爱"
                                                }
                                                while(status == "单身"){
                                                    age ++;
                                                    if(age > 110){
                                                        console.log(age*1111/111);
                                                        break;
                                                        getInlove();
                                                    }
                                                }
                                                

                                                  来个短的,保存成文件在Ubuntu控制台运行。

                                                  #!/usr/bin/tail -1
                                                  1111
                                                  
                                                    // 抽象语言
                                                    

                                                    各位大神回答的太复杂,看我的头像,会联想到什么?
                                                    恭喜您回答正确,答案就是:1111.

                                                      • 42

                                                      我爱的人不爱我,爱我的人一个没有!!!

                                                      <?php
                                                      class Person
                                                      {
                                                          private $attr = array('gender'=>0,'beautiful'=>0,'money'=>0,'profession'=>0,'character'=>0);
                                                          private $feel = 0;
                                                          public function __construct($attr){
                                                              $this->attr = $attr;
                                                          }
                                                          public function getAttr(){
                                                              return $this->attr;
                                                          }
                                                          public function DoMyGirlfriend(){
                                                              return null;
                                                          }
                                                      }
                                                      
                                                      class MyGirlFriend
                                                      {
                                                          private $demand = array('gender'=>'女','beautiful'=>90,'money'=>5000000,'profession'=>80,'character'=>80);
                                                          private $feel = 0;
                                                          public function isMygf($persion){
                                                              $attr = $persion->getAttr();
                                                              $demand = $this->demand;
                                                              if($attr['gender'] == $demand['gender']){
                                                                  $this->feel += 1;
                                                              }
                                                              if($attr['beautiful'] >= $demand['beautiful']){
                                                                  $this->feel += 20;
                                                              }
                                                              if($attr['money'] >= $demand['money']){
                                                                  $this->feel += 20;
                                                              }
                                                              if($attr['profession'] >= $demand['profession']){
                                                                  $this->feel += 20;
                                                              }
                                                              if($attr['character'] >= $demand['character']){
                                                                  $this->feel += 20;
                                                              }
                                                              $this->feel += rand(0,19);
                                                              $gf = null;
                                                              if($this->feel == 100){
                                                                  $gf = $persion->DoMyGirlfriend();
                                                              }
                                                              return $gf;
                                                          }
                                                      
                                                      
                                                      }
                                                      
                                                      $peple = 1000;
                                                      while($peple--){
                                                          $gender = array(1=>'男',2=>'女');
                                                          $attr = array('gender'=>$gender[rand(1,2)],'beautiful'=>rand(0,100),'money'=>rand(0,5000000),'profession'=>rand(0,100),'character'=>rand(0,100));
                                                          $ps = new Person($attr);
                                                          $mgf = new MyGirlFriend();
                                                          var_dump($mgf->isMygf($ps));
                                                          echo '<br>';
                                                      }
                                                      
                                                        • 2
                                                        • 新人请关照
                                                        Brainfuck Code
                                                        ++该++代++码++输++出++1++1++1++1++。++FFF路过+++++++++++++++++++++++++++....
                                                        
                                                          • 296

                                                          觉得自己很不单纯,玩的都是搞基之类的。
                                                          下图是将1111转义后的形状,请勿联想。

                                                              __    __    __    __    
                                                             /' \  /' \  /' \  /' \   
                                                             " ||  " ||  " ||  " ||   
                                                               ||    ||    ||    ||   
                                                               ||    ||    ||    ||   
                                                              _||_  _||_  _||_  _||_  
                                                             (_/\_)(_/\_)(_/\_)(_/\_) 
                                                          

                                                          想搞基的可以点 搞基不孤单.

                                                          貌似没有点题,要匿了。

                                                            • 2
                                                            • 新人请关照

                                                            这几天在看Android,然后学以致用一下
                                                            不要说它难看,用过的都说好
                                                            网盘
                                                            其实就是伪造某人给你发11条短信而已,>_>
                                                            !!不要拿来做不该做的事
                                                            //4.x版本可能不能使用
                                                            //担心安全问题可以使用模拟器感受一下,链接

                                                            图片描述

                                                            更多图片

                                                            图
                                                            图
                                                            图
                                                            图

                                                              • 6.8k

                                                              哎呀,最后一公里赛码角逐了,到底谁会脱颖而出呢?前三名,前五名。我来打个酱油。

                                                              // language: javascript
                                                              var ask = '1111,你脱单了吗?';
                                                                  ask = ask.replace('脱单','买单');
                                                                  console.log(ask);
                                                              

                                                              顺带来一下无聊写的代码:

                                                              var ans = document.getElementsByClassName('widget-answers__item'),
                                                               res = [],
                                                               per,ob,i;
                                                              for(i=0; i<ans.length;i++){
                                                               per = ans[i];
                                                               ob = {};
                                                               if(!per.getElementsByClassName('mr5')[0])continue;
                                                               ob.name = per.getElementsByClassName('mr5')[0].text;
                                                               ob.zan = per.getElementsByClassName('count')[0].innerText;
                                                                  res.push(ob);
                                                              }
                                                              console.log('%csf-11.11-码会:当前赛况','background:#000;color:#0f0;font-size:3em;');
                                                              console.table(res);
                                                              

                                                              以上代码的简版(by @公子

                                                              console.log('%csf-11.11-码会:当前赛况','background:#000;color:#0f0;font-size:3em;');
                                                              console.table([].slice.call(document.querySelectorAll(".widget-answers__item")).map(function(answer){
                                                                  if(!answer.querySelector(".mr5")) return false;
                                                                  return {
                                                                      name: answer.querySelector(".mr5").text,
                                                                      zan: answer.querySelector(".count").innerHTML
                                                                  };
                                                              }));
                                                              
                                                                // language: swift
                                                                println("已婚")
                                                                
                                                                  • 2.5k
                                                                  //javascript
                                                                  console.log(!"你有女朋友吗?true:false");
                                                                  
                                                                    Stack stack = new Stack();
                                                                    try{
                                                                        while(true){
                                                                            if(单身){
                                                                                stack.push("非面向对象编程");
                                                                            }
                                                                            else{
                                                                                stack.push("面向对象编程");
                                                                            }
                                                                    
                                                                        }
                                                                    } catch (FullStackException e){
                                                                        log.error("full stack developer");
                                                                    }finally{
                                                                        log.info("对象都没,搞什么面向对象编程!");
                                                                    }
                                                                    

                                                                      code: 1111.php
                                                                      <?php
                                                                      echo "1111\n";

                                                                      ubuntu终端里执行
                                                                      php 1111.php

                                                                        // language: text
                                                                        1111

                                                                          //javascript
                                                                          
                                                                          var 单身狗 = {
                                                                              name:"狗蛋",
                                                                              sex:"处男",
                                                                              height:"175cm-以下",
                                                                              money:"拖祖国后腿",
                                                                              handsome:"丑"
                                                                          };
                                                                          
                                                                          var 脱单 = function(height,money,handsome){
                                                                                 if(height > 175 && money > 月薪过万甚至更高 && handsome == "帅")
                                                                                  {
                                                                                      return "约会机会";
                                                                                  }else
                                                                                  {
                                                                                      return "1111";
                                                                                  }
                                                                          };
                                                                          
                                                                            • 139
                                                                            var diaosi = {
                                                                                name: diaosi,
                                                                                sex: male,
                                                                                sexTo: male,
                                                                                age: 21,
                                                                                gils: [],
                                                                                isGuanggun: function () { 
                                                                                                return this.gils.length > 0? false: true;
                                                                                            }
                                                                            }
                                                                            
                                                                            function burn(people) {
                                                                                if (people.hasOwnProperty('isGuanggun') && !people.isGuanggun) {
                                                                                    alert("烧死" + people.name);
                                                                                }
                                                                            }
                                                                            
                                                                            for (people in segmentfault) {
                                                                                burn(people);
                                                                            }
                                                                            console.log("1111, I'm happy!");
                                                                            
                                                                              • 2
                                                                              • 新人请关照
                                                                              # language: ruby
                                                                              destiny = rand(7e9)
                                                                              puts "Your destined another half (him or her) is the #{destiny}th person you meet."
                                                                              puts "Assume you meet 200 people per day, it takes #{destiny/200/365} years."
                                                                              puts "Perhaps that's too long, so let's assume you meet 1000 people per day, the number will be down to #{destiny/1000/365} years."
                                                                              puts "Pretty short, isn't it? :)"
                                                                              
                                                                                • 1
                                                                                • 新人请关照
                                                                                // language: javascript
                                                                                console.log('1111,不属于电商,只属于单身汪');
                                                                                
                                                                                  • 2
                                                                                  • 新人请关照

                                                                                  图片描述

                                                                                    • 227
                                                                                    cout<<"1111"<endl;
                                                                                    

                                                                                      //PHP

                                                                                      <?php echo 1111 ?>
                                                                                      
                                                                                        • 1.2k

                                                                                        ゚ω゚ノ= /`m´)ノ ~┻━┻ //´∇`/ ['']; o=(゚ー゚) ==3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^^o)/ (o^^o);(゚Д゚)={゚Θ゚: '' ,゚ω゚ノ : ((゚ω゚ノ==3) +'') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '')[o^^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'') [c^^o];(゚Д゚) ['c'] = ((゚Д゚)+'') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'')[゚Θ゚]+ ((゚ω゚ノ==3) +'') [゚ー゚] + ((゚Д゚) +'') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'') [゚Θ゚]+((゚ー゚==3) +'') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'') [゚Θ゚];(゚Д゚) [''] =(o^^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'') [o^^o -゚Θ゚]+((゚ー゚==3) +'') [゚Θ゚]+ (゚ω゚ノ +'') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'')[c^^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) [''] ( (゚Д゚) [''] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^^o) +(o^^o))+ ((o^^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^^o) +(o^^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((o^^o) +(o^^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^^o) +(o^^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^^o) +(o^^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+((o^^o) +(o^^o))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('');

                                                                                          console.warn("1111");
                                                                                          
                                                                                            • 2
                                                                                            • 新人请关照
                                                                                            import java.lang.reflect.Field;
                                                                                            public class A {
                                                                                                public static void main(String[] a) throws Exception {
                                                                                                Field c = Integer.class.getDeclaredClasses()[0]
                                                                                                        .getDeclaredField("cache");
                                                                                                c.setAccessible(true);
                                                                                                Integer[] y = (Integer[]) c.get(null);
                                                                                                y[129] = y[133];y[139] = y[130];y[239] = y[128];
                                                                                                /** 结果是什么? */
                                                                                                System.out.printf("%d%d%d", 1, 11, 111);
                                                                                                }
                                                                                            }
                                                                                            
                                                                                              • 1
                                                                                              • 新人请关照
                                                                                              #include <stdio.h>
                                                                                              #include <stdlib.h>
                                                                                              #include <assert.h>
                                                                                              
                                                                                              typedef unsigned short oid_t;
                                                                                              
                                                                                              #define ARRAY_SIZE(a)  (sizeof(a)/sizeof(a[0]))
                                                                                              #define SNMP_TAG_NO_ERR          0x0
                                                                                              #define SNMP_TAG_NO_SUCH_OBJ     0x80
                                                                                              #define SNMP_TAG_END_OF_MIB_VIEW 0x82
                                                                                              
                                                                                              struct mib_node {
                                                                                                const char *name;
                                                                                                int sub_id_cnt;
                                                                                                int sub_id_cap;
                                                                                                oid_t *sub_id;
                                                                                                void **sub_ptr;
                                                                                              };
                                                                                              
                                                                                              static struct mib_node dummy_root = {
                                                                                                "",
                                                                                                0,
                                                                                                1,
                                                                                                NULL,
                                                                                                NULL
                                                                                              };
                                                                                              
                                                                                              static oid_t *
                                                                                              oid_dup(const oid_t *oid, size_t len)
                                                                                              {
                                                                                                int i;
                                                                                                oid_t *new_oid = malloc(len * sizeof(oid_t));
                                                                                                if (new_oid != NULL) {
                                                                                                  for (i = 0; i < len; i++) {
                                                                                                    new_oid[i] = oid[i];
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                return new_oid;
                                                                                              }
                                                                                              
                                                                                              int
                                                                                              oid_cmp(const oid_t *src, size_t src_len, const oid_t *target, size_t tar_len)
                                                                                              {
                                                                                                int ret = 0;
                                                                                              
                                                                                                while (src_len && tar_len && !(ret = (int)(*src++ - *target++))) {
                                                                                                  src_len--;
                                                                                                  tar_len--;
                                                                                                  continue;
                                                                                              }
                                                                                                if (!ret)
                                                                                                  return src_len - tar_len;
                                                                                                else
                                                                                                  return ret;
                                                                                              }
                                                                                              
                                                                                              oid_t *
                                                                                              oid_cpy(oid_t *oid_dest, const oid_t *oid_src, size_t len)
                                                                                              {
                                                                                                oid_t *dest = oid_dest;
                                                                                              
                                                                                                while (len-- > 0) {
                                                                                                  *dest++ = *oid_src++;
                                                                                                }
                                                                                              
                                                                                                return oid_dest;
                                                                                              }
                                                                                              
                                                                                              int
                                                                                              oid_binary_search(oid_t *arr, int len, oid_t target)
                                                                                              {
                                                                                                int low = -1;
                                                                                                int high = len;
                                                                                              
                                                                                                assert(high >= 0);
                                                                                                while (low + 1 < high) {
                                                                                                  int mid = low + (high - low) / 2;
                                                                                                  if (arr[mid] > target) {
                                                                                                    high = mid;
                                                                                                  } else {
                                                                                                    low = mid;
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                if (arr[low] != target || low == -1)
                                                                                                  return -low - 2;
                                                                                                else
                                                                                                  return low;
                                                                                              }
                                                                                              
                                                                                              struct oid_search_result {
                                                                                                /* Return oid */
                                                                                                oid_t *oid;
                                                                                                size_t id_len;
                                                                                                /* Return status */
                                                                                                int exist_status;
                                                                                              };
                                                                                              
                                                                                              struct mib_node *
                                                                                              mib_tree_get(const oid_t *oid, size_t id_len, struct oid_search_result *ret_oid)
                                                                                              {
                                                                                                struct mib_node *node;
                                                                                              
                                                                                                node = &dummy_root;
                                                                                                ret_oid->oid = (oid_t *)oid;
                                                                                                ret_oid->id_len = id_len;
                                                                                              
                                                                                                while (node != NULL && id_len > 0) {
                                                                                                  int i = oid_binary_search(node->sub_id, node->sub_id_cnt, *oid);
                                                                                                  if (i >= 0) {
                                                                                                    /* Match */
                                                                                                    node = node->sub_ptr[i];
                                                                                                    printf("%s ", node->name);
                                                                                                    oid++;
                                                                                                    id_len--;
                                                                                                    continue;
                                                                                                  } else {
                                                                                                    /* Not match */
                                                                                                    ret_oid->exist_status = SNMP_TAG_NO_SUCH_OBJ;
                                                                                                    return NULL;
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                ret_oid->exist_status = SNMP_TAG_NO_ERR;
                                                                                                return node;
                                                                                              }
                                                                                              
                                                                                              #define OID_MAX_LEN  64
                                                                                              
                                                                                              struct node_backlog {
                                                                                                /* node to be backlogged */
                                                                                                struct mib_node *node;
                                                                                                /* next sub-id index of the node */
                                                                                                int n_idx;
                                                                                              };
                                                                                              
                                                                                              static void
                                                                                              nbl_push(struct node_backlog *nbl, struct node_backlog **top, struct node_backlog **buttom)
                                                                                              {
                                                                                                if (*top - *buttom < OID_MAX_LEN) {
                                                                                                  (*(*top)++) = *nbl;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              static struct node_backlog *
                                                                                              nbl_pop(struct node_backlog **top, struct node_backlog **buttom)
                                                                                              {
                                                                                                if (*top - *buttom > 0)
                                                                                                  return --*top;
                                                                                                else
                                                                                                  return NULL;
                                                                                              }
                                                                                              
                                                                                              /* Test a newly allocated mib node. */
                                                                                              static inline int
                                                                                              is_leaf(struct mib_node *node)
                                                                                              {
                                                                                                return node->sub_id[0] == 0 && node->sub_id_cnt == 0;
                                                                                              }
                                                                                              
                                                                                              struct mib_node *
                                                                                              mib_tree_get_next(const oid_t *orig_oid, size_t orig_id_len, struct oid_search_result *ret_oid)
                                                                                              {
                                                                                                oid_t *oid;
                                                                                                size_t id_len;
                                                                                                struct node_backlog *top, *buttom, nbl_stack[OID_MAX_LEN];
                                                                                                struct node_backlog *p_nbl, nbl;
                                                                                                struct mib_node *node;
                                                                                                int immediate;
                                                                                              
                                                                                                /* Init something */
                                                                                                ret_oid->oid = oid_dup(orig_oid, orig_id_len);
                                                                                                ret_oid->id_len = orig_id_len;
                                                                                                oid = ret_oid->oid;
                                                                                                id_len = ret_oid->id_len;
                                                                                                ret_oid->exist_status = SNMP_TAG_NO_ERR;
                                                                                                top = buttom = nbl_stack;
                                                                                                node = &dummy_root;
                                                                                                p_nbl = NULL;
                                                                                                immediate = 0;
                                                                                              
                                                                                                for (; ;) {
                                                                                              
                                                                                                  if (node != NULL) {
                                                                                                    if (immediate) {
                                                                                                      /* If leaf node, that's it! */
                                                                                                      if (is_leaf(node)) {
                                                                                                        ret_oid->id_len -= id_len;
                                                                                                        return node;
                                                                                                      }
                                                                                              
                                                                                                      /* Search the immediate close node. */
                                                                                                      int i;
                                                                                                      if (p_nbl != NULL) {
                                                                                                        /* Fetch the pop-up backlog sub-id */
                                                                                                        i = p_nbl->n_idx;
                                                                                                        p_nbl = NULL;
                                                                                                      } else {
                                                                                                        /* Just fetch the first sub-id */
                                                                                                        i = 0;
                                                                                                      }
                                                                                              
                                                                                                      if (i + 1 >= node->sub_id_cnt) {
                                                                                                        /* Last sub-id, mark NULL and -1. */
                                                                                                        nbl.node = NULL;
                                                                                                        nbl.n_idx = -1;
                                                                                                      } else {
                                                                                                        nbl.node = node;
                                                                                                        nbl.n_idx = i + 1;
                                                                                                      }
                                                                                                      /* Backlog the current node and move on */
                                                                                                      nbl_push(&nbl, &top, &buttom);
                                                                                                      *oid++ = node->sub_id[i];
                                                                                                      id_len--;
                                                                                                      node = node->sub_ptr[i];
                                                                                                      printf("%s ", node->name);
                                                                                                    } else {
                                                                                                      /* Find the match oid */
                                                                                                      int index = oid_binary_search(node->sub_id, node->sub_id_cnt, *oid);
                                                                                                      int i = index;
                                                                                              
                                                                                                      if (index < 0) {
                                                                                                        /* Not found, switch to immediate mode */
                                                                                                        immediate = 1;
                                                                                                        /* Reverse the sign to locate the index */
                                                                                                        i = -i - 1;
                                                                                                        if (i == node->sub_id_cnt) {
                                                                                                          /* All sub-ids are greater than target;
                                                                                                           * Backtrack and fetch the next one. */
                                                                                                          goto BACK_TRACK;
                                                                                                        } else if (i == 0) {
                                                                                                          /* 1. All sub-ids are less than target;
                                                                                                           * 2. No sub-id in this node;
                                                                                                           * Switch to immediate mode. */
                                                                                                          continue;
                                                                                                        } /* else {
                                                                                                          Target is between the two sub-ids and [i] is the next one, 
                                                                                                          switch to immediate mode and move on.
                                                                                                        } */
                                                                                                      }
                                                                                              
                                                                                                      /* Sub-id found is greater or just equal to the target,
                                                                                                       * anyway, record the current node and push it into stack. */
                                                                                                      if (i + 1 >= node->sub_id_cnt) {
                                                                                                        nbl.node = NULL;
                                                                                                        nbl.n_idx = -1;
                                                                                                      } else {
                                                                                                        nbl.node = node;
                                                                                                        nbl.n_idx = i + 1;
                                                                                                      }
                                                                                                      /* Backlog the current node and move on. */
                                                                                                      nbl_push(&nbl, &top, &buttom);
                                                                                                      *oid++ = node->sub_id[i];
                                                                                                      node = node->sub_ptr[i];
                                                                                                      printf("%s ", node->name);
                                                                                                      if (--id_len == 0) {
                                                                                                        /* When oid length is decreased to zero, switch to the immediate mode */
                                                                                                        if (is_leaf(node)) {
                                                                                                          goto BACK_TRACK;
                                                                                                        } else {
                                                                                                          immediate = 1;
                                                                                                        }
                                                                                                      }
                                                                                                    }
                                                                                              
                                                                                                    continue; /* Go on loop */
                                                                                                  }
                                                                                              
                                                                                                  /* Backtracking condition:
                                                                                                   * 1. No greater sub-id in group node;
                                                                                                   * 2. Seek the immediate closest instance node.
                                                                                                   * 3. Node not exists(node == NULL).
                                                                                                   */
                                                                                              BACK_TRACK:
                                                                                                  p_nbl = nbl_pop(&top, &buttom);
                                                                                                  if (p_nbl == NULL) {
                                                                                                    /* End of traversal */
                                                                                                    oid_cpy(ret_oid->oid, orig_oid, orig_id_len);
                                                                                                    ret_oid->id_len = orig_id_len;
                                                                                                    ret_oid->exist_status = SNMP_TAG_END_OF_MIB_VIEW;
                                                                                                    return &dummy_root;
                                                                                                  }
                                                                                                  oid--;
                                                                                                  id_len++;
                                                                                                  node = p_nbl->node;
                                                                                                  immediate = 1;  /* Switch to the immediate mode. */
                                                                                                }
                                                                                              
                                                                                                assert(0);
                                                                                                return NULL;
                                                                                              }
                                                                                              
                                                                                              /* Check if mib root node is initialized */
                                                                                              static inline int
                                                                                              mib_tree_init_check(void)
                                                                                              {
                                                                                                return (dummy_root.sub_id != NULL && dummy_root.sub_ptr != NULL);
                                                                                              }
                                                                                              
                                                                                              /* Resize mib node's sub-id array */
                                                                                              #define alloc_nr(x) (((x)+2)*3/2)
                                                                                              static void
                                                                                              mib_node_expand(struct mib_node *node, int index)
                                                                                              {
                                                                                                int i;
                                                                                              
                                                                                                assert(!is_leaf(node));
                                                                                                if (node->sub_id_cnt + 1 > node->sub_id_cap) {
                                                                                                  node->sub_id_cap = alloc_nr(node->sub_id_cap);
                                                                                              
                                                                                                  oid_t *sub_id = calloc(node->sub_id_cap, sizeof(oid_t));
                                                                                                  void **sub_ptr = calloc(node->sub_id_cap, sizeof(void *));
                                                                                                  assert(sub_id != NULL && sub_ptr != NULL);
                                                                                              
                                                                                                  /* Duplicate and insert */
                                                                                                  for (i = 0; i < node->sub_id_cnt; i++) {
                                                                                                    if (i < index) {
                                                                                                      sub_id[i] = node->sub_id[i];
                                                                                                      sub_ptr[i] = node->sub_ptr[i];
                                                                                                    } else {
                                                                                                      sub_id[i + 1] = node->sub_id[i];
                                                                                                      sub_ptr[i + 1] = node->sub_ptr[i];
                                                                                                    }
                                                                                                  }
                                                                                              
                                                                                                  /* Abandon old ones */
                                                                                                  free(node->sub_id);
                                                                                                  free(node->sub_ptr);
                                                                                                  node->sub_id = sub_id;
                                                                                                  node->sub_ptr = sub_ptr;
                                                                                                } else {
                                                                                                  /* Just insert. */
                                                                                                  for (i = node->sub_id_cnt - 1; i >= index; i--) {
                                                                                                    node->sub_id[i + 1] = node->sub_id[i];
                                                                                                    node->sub_ptr[i + 1] = node->sub_ptr[i];
                                                                                                  }
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              /* Shrink mib node's sub-id array when removing sub-nodes */
                                                                                              static void
                                                                                              mib_node_shrink(struct mib_node *node, int index)
                                                                                              {
                                                                                                int i;
                                                                                              
                                                                                                if (node->sub_id_cnt > 1) {
                                                                                                  for (i = index; i < node->sub_id_cnt - 1; i++) {
                                                                                                    node->sub_id[i] = node->sub_id[i + 1];
                                                                                                    node->sub_ptr[i] = node->sub_ptr[i + 1];
                                                                                                  }
                                                                                                  node->sub_id_cnt--;
                                                                                                } else {
                                                                                                  node->sub_id[0] = 0;
                                                                                                  node->sub_ptr[0] = NULL;
                                                                                                  node->sub_id_cnt = 0;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              static struct mib_node *
                                                                                              mib_node_new(const char *name)
                                                                                              {
                                                                                                struct mib_node *node = malloc(sizeof(*node));
                                                                                                if (node != NULL) {
                                                                                                  node->name = name;
                                                                                                  node->sub_id_cap = 1;
                                                                                                  node->sub_id_cnt = 0;
                                                                                                  node->sub_id = calloc(1, sizeof(oid_t));
                                                                                                  if (node->sub_id == NULL) {
                                                                                                    return NULL;
                                                                                                  }
                                                                                                  node->sub_ptr = calloc(1, sizeof(void *));
                                                                                                  if (node->sub_ptr == NULL) {
                                                                                                    free(node->sub_id);
                                                                                                    return NULL;
                                                                                                  }
                                                                                                }
                                                                                                return node;
                                                                                              }
                                                                                              
                                                                                              static void
                                                                                              mib_node_delete(struct mib_node *node)
                                                                                              {
                                                                                                if (node != NULL) {
                                                                                                  free(node->sub_id);
                                                                                                  free(node->sub_ptr);
                                                                                                  free(node);
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              /* parent-child relationship */
                                                                                              struct node_pair {
                                                                                                struct mib_node *parent;
                                                                                                struct mib_node *child;
                                                                                                int sub_idx;
                                                                                              };
                                                                                              
                                                                                              /* Find node through oid and get its parent. */
                                                                                              static struct mib_node *
                                                                                              mib_tree_node_search(const oid_t *oid, size_t id_len, struct node_pair *pair)
                                                                                              {
                                                                                                struct mib_node *parent = pair->parent = &dummy_root;
                                                                                                struct mib_node *node = pair->child = parent;
                                                                                                int sub_idx = 0;
                                                                                              
                                                                                                while (node != NULL && id_len > 0) {
                                                                                                  int i = oid_binary_search(node->sub_id, node->sub_id_cnt, *oid);
                                                                                                  if (i >= 0) {
                                                                                                    /* Sub-id found, go on loop */
                                                                                                    oid++;
                                                                                                    id_len--;
                                                                                                    sub_idx = i;
                                                                                                    parent = node;
                                                                                                    node = node->sub_ptr[i];
                                                                                                    continue;
                                                                                                  } else {
                                                                                                    /* Sub-id not found */
                                                                                                    pair->parent = parent;
                                                                                                    pair->child = node;
                                                                                                    pair->sub_idx = sub_idx;
                                                                                                    return NULL;
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                /* node == NULL || id_len == 0 */
                                                                                                /* Note: If target oid is the dummy root node, then
                                                                                                 * pair->parent == pair->child and pair->sub_idx == 0 */
                                                                                                pair->parent = parent;
                                                                                                pair->child = node;
                                                                                                pair->sub_idx = sub_idx;
                                                                                                return node;
                                                                                              }
                                                                                              
                                                                                              /* Remove specified node int mib-tree. */
                                                                                              static void
                                                                                              __mib_tree_delete(struct node_pair *pair)
                                                                                              {
                                                                                                struct node_backlog nbl, *p_nbl;
                                                                                                struct node_backlog *top, *buttom, nbl_stk[OID_MAX_LEN];
                                                                                                struct mib_node *node = pair->child;
                                                                                              
                                                                                                /* Dummy root node cannot be deleted */
                                                                                                if (node == &dummy_root) {
                                                                                                  return;
                                                                                                }
                                                                                              
                                                                                                /* Init something */
                                                                                                p_nbl = NULL;
                                                                                                top = buttom = nbl_stk;
                                                                                              
                                                                                                for (; ;) {
                                                                                              
                                                                                                  if (node != NULL) {
                                                                                              
                                                                                                      int i;
                                                                                                      if (p_nbl != NULL) {
                                                                                                        /* Fetch the pop-up backlog sub-id. */
                                                                                                        i = p_nbl->n_idx;
                                                                                                        p_nbl = NULL;
                                                                                                      } else {
                                                                                                        /* Fetch the first sub-id. */
                                                                                                        i = 0;
                                                                                                      }
                                                                                              
                                                                                                      if (i == -1) {
                                                                                                        /* All sub-trees empty, free this node and go on backtracking */
                                                                                                        mib_node_delete(node);
                                                                                                        node = NULL;
                                                                                                        continue;
                                                                                                      }
                                                                                              
                                                                                                      if (i + 1 >= node->sub_id_cnt) {
                                                                                                        /* Last sub-id, mark n_idx = -1. */
                                                                                                        nbl.n_idx = -1;
                                                                                                      } else {
                                                                                                        nbl.n_idx = i + 1;
                                                                                                      }
                                                                                                      nbl.node = node;
                                                                                              
                                                                                                      /* Backlog the current node and move down. */
                                                                                                      nbl_push(&nbl, &top, &buttom);
                                                                                                      node = node->sub_ptr[i++];
                                                                                                      continue;
                                                                                                  }
                                                                                              
                                                                                                  /* Backtracking */
                                                                                                  p_nbl = nbl_pop(&top, &buttom);
                                                                                                  if (p_nbl == NULL) {
                                                                                                    /* End of traversal. */
                                                                                                    mib_node_shrink(pair->parent, pair->sub_idx);
                                                                                                    return;
                                                                                                  }
                                                                                                  node = p_nbl->node;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              static void
                                                                                              mib_tree_delete(const oid_t *oid, size_t id_len)
                                                                                              {
                                                                                                struct node_pair pair;
                                                                                                struct mib_node *node;
                                                                                              
                                                                                                node = mib_tree_node_search(oid, id_len, &pair);
                                                                                                if (node != NULL) {
                                                                                                  __mib_tree_delete(&pair);
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              /* This function will create and insert new node(s) in mib tree according to oid
                                                                                               * and name given. The parent node(s) which corresponding to the oid prefix
                                                                                               * (except for the last id number) are assumed to be existing in mib tree.
                                                                                               */
                                                                                              static struct mib_node *
                                                                                              mib_tree_insert(const oid_t *oid, size_t id_len, const char *name)
                                                                                              {
                                                                                                struct mib_node *node = &dummy_root;
                                                                                              
                                                                                                while (id_len > 0) {
                                                                                                  if (is_leaf(node)) {
                                                                                                    /* Check the oid length */
                                                                                                    if (id_len != 1) {
                                                                                                      fprintf(stderr, "%s\'s parent node(s) have not been created!\n", name);
                                                                                                      return NULL;
                                                                                                    }
                                                                                                    /* Insert new mib node */
                                                                                                    node->sub_ptr[0] = mib_node_new(name);
                                                                                                    node->sub_id_cnt++;
                                                                                                    node->sub_id[0] = *oid++;
                                                                                                    node = node->sub_ptr[0];
                                                                                                    id_len--;
                                                                                                  } else {
                                                                                                    /* Search in sub-ids */
                                                                                                    int i = oid_binary_search(node->sub_id, node->sub_id_cnt, *oid);
                                                                                                    if (i >= 0) {
                                                                                                      /* Sub-id found, go on traversing */
                                                                                                      if (--id_len == 0) {
                                                                                                        fprintf(stderr, "Cannot insert at an existing node.\n");
                                                                                                        return NULL;
                                                                                                      }
                                                                                                      oid++;
                                                                                                      node = node->sub_ptr[i];
                                                                                                    } else {
                                                                                                      /* Sub-id not found, that's it. */
                                                                                                      i = -i - 1;
                                                                                                      /* Check the oid length */
                                                                                                      if (id_len != 1) {
                                                                                                        fprintf(stderr, "%s\'s parent node(s) have not been created!\n", name);
                                                                                                        return NULL;
                                                                                                      }
                                                                                                      /* Resize sub_id[] */
                                                                                                      mib_node_expand(node, i);
                                                                                                      /* Insert new mib node */
                                                                                                      node->sub_ptr[i] = mib_node_new(name);
                                                                                                      node->sub_id_cnt++;
                                                                                                      node->sub_id[i] = *oid++;
                                                                                                      node = node->sub_ptr[i];
                                                                                                      id_len--;
                                                                                                    }
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                /* id_len == 0 */
                                                                                                return node;
                                                                                              }
                                                                                              
                                                                                              static void
                                                                                              mib_tree_init(void)
                                                                                              {
                                                                                                struct mib_node *node = &dummy_root;
                                                                                                node->sub_id_cap = 1;
                                                                                                node->sub_id_cnt = 0;
                                                                                                node->sub_id = malloc(sizeof(oid_t));
                                                                                                if (node->sub_id == NULL) {
                                                                                                  return;
                                                                                                }
                                                                                                node->sub_id[0] = 0;
                                                                                                node->sub_ptr = malloc(sizeof(void *));
                                                                                                if (node->sub_ptr == NULL) {
                                                                                                  free(node->sub_id);
                                                                                                  return;
                                                                                                }
                                                                                                node->sub_ptr[0] = NULL;
                                                                                              }
                                                                                              
                                                                                              void
                                                                                              mib_tree_draw(void)
                                                                                              {
                                                                                                int level;
                                                                                                oid_t id;
                                                                                                struct mib_node *node = &dummy_root; 
                                                                                                struct node_backlog nbl, *p_nbl;
                                                                                                struct node_backlog *top, *buttom, nbl_stack[OID_MAX_LEN];
                                                                                              
                                                                                                top = buttom = nbl_stack;
                                                                                                p_nbl = NULL;
                                                                                                level = 0;
                                                                                                id = 0;
                                                                                              
                                                                                                for (; ;) {
                                                                                                  if (node != NULL) {
                                                                                                    int i;
                                                                                              
                                                                                                    if (p_nbl != NULL) {
                                                                                                      i = p_nbl->n_idx;
                                                                                                      p_nbl = NULL;
                                                                                                    } else {
                                                                                                      i = 0;
                                                                                                    }
                                                                                              
                                                                                                    if (i + 1 >= node->sub_id_cnt) {
                                                                                                      nbl.node = NULL;
                                                                                                      nbl.n_idx = -1;
                                                                                                    } else {
                                                                                                      nbl.node = node;
                                                                                                      nbl.n_idx = i + 1;
                                                                                                    }
                                                                                                    nbl_push(&nbl, &top, &buttom);
                                                                                              
                                                                                                    /* Draw lines */
                                                                                                    if (i == 0 && level > 0) {
                                                                                                      int j;
                                                                                                      for (j = 1; j < level; j++) {
                                                                                                        if (j == level - 1) {
                                                                                                            printf("%-8.8s", "|-------");
                                                                                                        } else {
                                                                                                          if (nbl_stack[j].n_idx != -1) {
                                                                                                            printf("%s", "|");
                                                                                                            printf("%-7.8s", " ");
                                                                                                          } else {
                                                                                                            printf("%-8.8s", " ");
                                                                                                          }
                                                                                                        }
                                                                                                      }
                                                                                                      printf("%s(%d)\n", node->name, id);
                                                                                                      for (j = 1; j < level; j++) {
                                                                                                        if (nbl_stack[j].n_idx != -1) {
                                                                                                          printf("%s", "|");
                                                                                                          printf("%-7.8s", " ");
                                                                                                        } else {
                                                                                                          printf("%-8s", " ");
                                                                                                        }
                                                                                                      }
                                                                                                      if (!is_leaf(node)) {
                                                                                                        printf("%-8s", "|");
                                                                                                      }
                                                                                                      printf("\n");
                                                                                                    }
                                                                                              
                                                                                                    /* Move on */
                                                                                                    id = node->sub_id[i];
                                                                                                    node = node->sub_ptr[i];
                                                                                                    level++;
                                                                                                    continue;
                                                                                                  }
                                                                                              
                                                                                                  p_nbl = nbl_pop(&top, &buttom);
                                                                                                  if (p_nbl == NULL) {
                                                                                                    /* End of traversal */
                                                                                                    return;
                                                                                                  }
                                                                                                  node = p_nbl->node;
                                                                                                  level--;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              int main(void)
                                                                                              {
                                                                                                int i;
                                                                                                struct oid_search_result ret_oid;
                                                                                                struct mib_node *node;
                                                                                              
                                                                                                oid_t dummy[] = {};
                                                                                                oid_t we[] = { 1 };
                                                                                                oid_t are[] = { 1, 1 };
                                                                                                oid_t as[] = { 1, 1, 1 };
                                                                                                oid_t one[] = { 1, 1, 1, 1 };
                                                                                                oid_t never[] = { 1, 3 };
                                                                                                oid_t be[] = { 1, 3, 1 };
                                                                                                oid_t dod[] = { 1, 3, 6 };
                                                                                                oid_t apart[] = { 1, 3, 1, 4 };
                                                                                                oid_t internet[] = { 1, 3, 6, 1 };
                                                                                                oid_t mgmt[] = { 1, 3, 6, 1, 2 };
                                                                                                oid_t mib_2[] = {1, 3, 6, 1, 2, 1};
                                                                                                oid_t system[] = { 1, 3, 6, 1, 2, 1, 1 };
                                                                                                oid_t interfaces[] = { 1, 3, 6, 1, 2, 1, 2 };
                                                                                                oid_t at[] = { 1, 3, 6, 1, 2, 1, 3 };
                                                                                                oid_t ip[] = { 1, 3, 6, 1, 2, 1, 4 };
                                                                                                oid_t icmp[] = { 1, 3, 6, 1, 2, 1, 5 };
                                                                                                oid_t tcp[] = { 1, 3, 6, 1, 2, 1, 6 };
                                                                                                oid_t udp[] = { 1, 3, 6, 1, 2, 1, 7 };
                                                                                                oid_t private[] = { 1, 3, 6, 1, 4 };
                                                                                                oid_t enterprises[] = { 1, 3, 6, 1, 4, 1 };
                                                                                                oid_t traps[] = { 1, 3, 6, 1, 6 };
                                                                                              
                                                                                                mib_tree_init();
                                                                                              
                                                                                                mib_tree_insert(dummy, ARRAY_SIZE(dummy), "dummy");
                                                                                                mib_tree_insert(we, ARRAY_SIZE(we), "we");
                                                                                                mib_tree_insert(are, ARRAY_SIZE(are), "are");
                                                                                                mib_tree_insert(as, ARRAY_SIZE(as), "as");
                                                                                                mib_tree_insert(one, ARRAY_SIZE(one), "one");
                                                                                                mib_tree_insert(never, ARRAY_SIZE(never), "never");
                                                                                                mib_tree_insert(be, ARRAY_SIZE(be), "be");
                                                                                                mib_tree_insert(apart, ARRAY_SIZE(apart), "apart");
                                                                                                mib_tree_insert(dod, ARRAY_SIZE(dod), "dod");
                                                                                                mib_tree_insert(internet, ARRAY_SIZE(internet), "internet");
                                                                                                mib_tree_insert(mgmt, ARRAY_SIZE(mgmt), "mgmt");
                                                                                                mib_tree_insert(mib_2, ARRAY_SIZE(mib_2), "mib_2");
                                                                                                mib_tree_insert(system, ARRAY_SIZE(system), "system");
                                                                                                mib_tree_insert(interfaces, ARRAY_SIZE(interfaces), "interfaces");
                                                                                                mib_tree_insert(at, ARRAY_SIZE(at), "at");
                                                                                                mib_tree_insert(ip, ARRAY_SIZE(ip), "ip");
                                                                                                mib_tree_insert(icmp, ARRAY_SIZE(icmp), "icmp");
                                                                                                mib_tree_insert(tcp, ARRAY_SIZE(tcp), "tcp");
                                                                                                mib_tree_insert(udp, ARRAY_SIZE(udp), "udp");
                                                                                                mib_tree_insert(private, ARRAY_SIZE(private), "private");
                                                                                                mib_tree_insert(enterprises, ARRAY_SIZE(enterprises), "enterprises");
                                                                                                mib_tree_insert(traps, ARRAY_SIZE(traps), "traps");
                                                                                              
                                                                                                mib_tree_draw();
                                                                                              
                                                                                                /* Get request */
                                                                                                printf("Get node: ");
                                                                                                node = mib_tree_get(one, ARRAY_SIZE(one), &ret_oid);
                                                                                                assert(node != NULL && ret_oid.exist_status == SNMP_TAG_NO_ERR);
                                                                                                for (i = 0; i < ret_oid.id_len; i++) {
                                                                                                  printf(".%d", ret_oid.oid[i]);
                                                                                                }
                                                                                                printf("\n");
                                                                                              
                                                                                                /* Getnext request */
                                                                                                printf("Getnext node: ");
                                                                                                node = mib_tree_get_next(one, ARRAY_SIZE(one), &ret_oid);
                                                                                                assert(node != NULL && ret_oid.exist_status == SNMP_TAG_NO_ERR);
                                                                                                for (i = 0; i < ret_oid.id_len; i++) {
                                                                                                  printf(".%d", ret_oid.oid[i]);
                                                                                                }
                                                                                                printf("\n");
                                                                                                free(ret_oid.oid);
                                                                                              
                                                                                                mib_tree_delete(dod, ARRAY_SIZE(dod));
                                                                                              
                                                                                                printf("After delete node ");
                                                                                                for (i = 0; i < ARRAY_SIZE(dod); i++) {
                                                                                                  printf(".%d", dod[i]);
                                                                                                }
                                                                                                printf(":\n");
                                                                                              
                                                                                                mib_tree_draw();
                                                                                              
                                                                                                return 0;  
                                                                                              }
                                                                                              
                                                                                              /**********************
                                                                                              * Licence: MIT
                                                                                              * Author: Leo Ma
                                                                                              * Date: 2014-03-12
                                                                                              *********************/
                                                                                              
                                                                                              #include <stdio.h>
                                                                                              #include <stdlib.h>
                                                                                              
                                                                                              #define MAX_LEVEL 32  /* Should be enough for 2^32 elements */
                                                                                              
                                                                                              struct sk_link {
                                                                                                struct sk_link *next, *prev;
                                                                                                unsigned int span;
                                                                                              };
                                                                                              
                                                                                              struct range_spec {
                                                                                                int min, max;
                                                                                                int minex, maxex;
                                                                                              };
                                                                                              
                                                                                              struct man {
                                                                                                int level;
                                                                                                int dog_num;
                                                                                                struct sk_link collar[MAX_LEVEL];
                                                                                              };
                                                                                              
                                                                                              struct dog {
                                                                                                int price;
                                                                                                struct sk_link link[];
                                                                                              };
                                                                                              
                                                                                              static inline void
                                                                                              sklist_init(struct sk_link *link)
                                                                                              {
                                                                                                link->prev = link;
                                                                                                link->next = link;
                                                                                              }
                                                                                              
                                                                                              static inline void
                                                                                              __sklist_add(struct sk_link *link, struct sk_link *prev, struct sk_link *next)
                                                                                              {
                                                                                                link->next = next;
                                                                                                link->prev = prev;
                                                                                                next->prev = link;
                                                                                                prev->next = link;
                                                                                              }
                                                                                              
                                                                                              static inline void
                                                                                              __sklist_del(struct sk_link *prev, struct sk_link *next)
                                                                                              {
                                                                                                prev->next = next;
                                                                                                next->prev = prev; 
                                                                                              }
                                                                                              
                                                                                              static inline void
                                                                                              sklist_add(struct sk_link *link, struct sk_link *next)
                                                                                              {
                                                                                                __sklist_add(link, next->prev, next);
                                                                                              }
                                                                                              
                                                                                              static inline void
                                                                                              sklist_del(struct sk_link *link)
                                                                                              {
                                                                                                __sklist_del(link->prev, link->next);
                                                                                                sklist_init(link);
                                                                                              }
                                                                                              
                                                                                              static inline int
                                                                                              sklist_empty(struct sk_link *link)
                                                                                              {
                                                                                                return link->next == link;
                                                                                              }
                                                                                              
                                                                                              #define sklist_entry(ptr, type, member) \
                                                                                                ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
                                                                                              
                                                                                              #define sklist_foreach_forward(pos, end) \
                                                                                                for (; pos != end; pos = pos->next)
                                                                                              
                                                                                              #define sklist_foreach_forward_safe(pos, n, end) \
                                                                                                for (n = pos->next; pos != end; pos = n, n = pos->next)
                                                                                              
                                                                                              #define sklist_foreach_backward(pos, end) \
                                                                                                for (; pos != end; pos = pos->prev)
                                                                                              
                                                                                              #define sklist_foreach_backward_safe(pos, n, end) \
                                                                                                for (n = pos->prev; pos != end; pos = n, n = pos->prev)
                                                                                              
                                                                                              // Wow!
                                                                                              struct dog *
                                                                                              dog_birth(int level, int price)
                                                                                              {
                                                                                                struct dog *dog;
                                                                                              
                                                                                                dog = (struct dog *)malloc(sizeof(*dog) + level * sizeof(struct sk_link));
                                                                                                if (dog == NULL)
                                                                                                  return NULL;
                                                                                              
                                                                                                dog->price = price;
                                                                                                return dog;
                                                                                              }
                                                                                              
                                                                                              // Wow! Wow! Wow! Wowwwwwwwwwwwwwww...
                                                                                              void
                                                                                              dog_kill(struct dog *dog)
                                                                                              {
                                                                                                free(dog);
                                                                                              }
                                                                                              
                                                                                              // Come on, baby!
                                                                                              struct man *
                                                                                              man_birth()
                                                                                              {
                                                                                                int i;
                                                                                                struct man *man;
                                                                                              
                                                                                                man = (struct man *)malloc(sizeof(*man));
                                                                                                if (man == NULL)
                                                                                                  return NULL;
                                                                                              
                                                                                                man->level = 1;
                                                                                                man->dog_num = 0;
                                                                                                for (i = 0; i < sizeof(man->collar) / sizeof(man->collar[0]); i++) {
                                                                                                  sklist_init(&man->collar[i]);
                                                                                                  man->collar[i].span = 0;
                                                                                                }
                                                                                              
                                                                                                return man;
                                                                                              }
                                                                                              
                                                                                              // Please don't, Bro! please!
                                                                                              void
                                                                                              man_kill(struct man *man)
                                                                                              {
                                                                                                struct sk_link *pos, *n;
                                                                                                struct dog *dog;
                                                                                              
                                                                                                pos = man->collar[0].next;
                                                                                                sklist_foreach_forward_safe(pos, n, &man->collar[0]) {
                                                                                                  dog = sklist_entry(pos, struct dog, link[0]);
                                                                                                  dog_kill(dog);
                                                                                                }
                                                                                              
                                                                                                free(man);
                                                                                              }
                                                                                              
                                                                                              static int
                                                                                              random_level(void)
                                                                                              {
                                                                                                const double SKIPLIST_P = 0.25;
                                                                                                int level = 1;
                                                                                                while ((random() & 0xffff) < 0xffff * SKIPLIST_P)
                                                                                                  level++;
                                                                                                return level > MAX_LEVEL ? MAX_LEVEL : level;
                                                                                              }
                                                                                              
                                                                                              /* O^_^O */
                                                                                              void
                                                                                              adopt(struct man *man, int price)
                                                                                              {
                                                                                                int i, level, rank[MAX_LEVEL];
                                                                                                struct sk_link *pos, *end, *update[MAX_LEVEL];
                                                                                                struct dog *dog;
                                                                                              
                                                                                                level = random_level();
                                                                                                if (level > man->level)
                                                                                                  man->level = level;
                                                                                              
                                                                                                dog = dog_birth(level, price);
                                                                                                if (dog == NULL)
                                                                                                  return;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  rank[i] = i == man->level - 1 ? 0 : rank[i + 1];
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward(pos, end) {
                                                                                                    struct dog *d = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (d->price >= price) {
                                                                                                      end = &d->link[i];
                                                                                                      break;
                                                                                                    }
                                                                                                    rank[i] += d->link[i].span;
                                                                                                  }
                                                                                              
                                                                                                  update[i] = end;
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                for (i = 0; i < man->level; i++) {
                                                                                                  if (i < level) {
                                                                                                    sklist_add(&dog->link[i], update[i]);
                                                                                                    dog->link[i].span = rank[0] - rank[i] + 1;
                                                                                                    update[i]->span -= dog->link[i].span - 1;
                                                                                                  } else {
                                                                                                    update[i]->span++;
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                man->dog_num++;
                                                                                              }
                                                                                              
                                                                                              /* T_T */
                                                                                              void
                                                                                              __abandon(struct man *man, struct dog *dog, int level, struct sk_link **update)
                                                                                              {
                                                                                                int i;
                                                                                              
                                                                                                for (i = 0; i < man->level; i++) {
                                                                                                  if (i < level) {
                                                                                                    sklist_del(&dog->link[i]);
                                                                                                    update[i] = dog->link[i].next;
                                                                                                    update[i]->span += dog->link[i].span - 1;
                                                                                                  } else {
                                                                                                    update[i]->span--;
                                                                                                  }
                                                                                              
                                                                                                  if (sklist_empty(&man->collar[i])) {
                                                                                                    man->level--;
                                                                                                  }
                                                                                                }
                                                                                              
                                                                                                dog_kill(dog);
                                                                                                man->dog_num--;
                                                                                              }
                                                                                              
                                                                                              /* T_T */
                                                                                              void
                                                                                              abandon(struct man *man, int price)
                                                                                              {
                                                                                                int i;
                                                                                                struct sk_link *pos, *n, *end, *update[MAX_LEVEL];
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward_safe(pos, n, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (dog->price > price) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    } else if (dog->price == price) {
                                                                                                      // Here's no break statement because we allow dogs with same price.
                                                                                                      __abandon(man, dog, i + 1, update);
                                                                                                    }
                                                                                                  }
                                                                                                  update[i] = end;
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              int
                                                                                              price_gte_min(int price, struct range_spec *range)
                                                                                              {
                                                                                                return range->maxex ? (price > range->max) : (price >= range->max);
                                                                                              }
                                                                                              
                                                                                              int
                                                                                              price_lte_max(int price, struct range_spec *range)
                                                                                              {
                                                                                                return range->minex ? (price < range->min) : (price <= range->min);
                                                                                              }
                                                                                              
                                                                                              /* Returns if there is dog price in range */
                                                                                              int
                                                                                              price_in_range(struct man *man, struct range_spec *range)
                                                                                              {
                                                                                                struct dog *dog;
                                                                                                struct sk_link *link;
                                                                                              
                                                                                                if (range->min > range->max ||
                                                                                                  (range->min == range->max && (range->minex || range->maxex)))
                                                                                                  return 0;
                                                                                              
                                                                                                if (sklist_empty(&man->collar[0]))
                                                                                                  return 0;
                                                                                              
                                                                                                link = man->collar[0].next;
                                                                                                dog = sklist_entry(link, struct dog, link[0]);
                                                                                                if (!price_lte_max(dog->price, range))
                                                                                                  return 0;
                                                                                              
                                                                                                link = man->collar[0].prev;
                                                                                                dog = sklist_entry(link, struct dog, link[0]);
                                                                                                if (!price_gte_min(dog->price, range))
                                                                                                  return 0;
                                                                                              
                                                                                                return 1;
                                                                                              }
                                                                                              
                                                                                              
                                                                                              /* Find the first dog price that is contained in the specified range
                                                                                               * where min and max are inclusive. */
                                                                                              struct dog *
                                                                                              first_in_range(struct man *man, struct range_spec *range)
                                                                                              {
                                                                                                int i;
                                                                                                struct dog *dog = NULL;
                                                                                                struct sk_link *pos, *end;
                                                                                              
                                                                                                if (!price_in_range(man, range))
                                                                                                  return NULL;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward(pos, end) {
                                                                                                    dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (price_gte_min(dog->price, range)) {
                                                                                                      pos = dog->link[i].prev;
                                                                                                      end = dog->link[i].next;
                                                                                                      goto CONTINUE;
                                                                                                    }
                                                                                                  }
                                                                                                  pos = end->prev;
                                                                                              CONTINUE:
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return dog;
                                                                                              }
                                                                                              
                                                                                              /* Find the last dog price that is contained in the specified range
                                                                                               * where min and max are inclusive. */
                                                                                              struct dog *
                                                                                              last_in_range(struct man *man, struct range_spec *range)
                                                                                              {
                                                                                                int i;
                                                                                                struct dog *dog = NULL;
                                                                                                struct sk_link *pos, *end;
                                                                                              
                                                                                                if (!price_in_range(man, range))
                                                                                                  return NULL;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->prev;
                                                                                                  sklist_foreach_backward(pos, end) {
                                                                                                    dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (price_lte_max(dog->price, range)) {
                                                                                                      pos = dog->link[i].next;
                                                                                                      end = dog->link[i].prev;
                                                                                                      goto CONTINUE;
                                                                                                    }
                                                                                                  }
                                                                                                  pos = end->next;
                                                                                              CONTINUE:
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return dog;
                                                                                              }
                                                                                              
                                                                                              /* Abandon all the dogs with price in range
                                                                                               * where min and max are inclusive. */
                                                                                              unsigned int
                                                                                              abandon_in_range(struct man *man, struct range_spec *range)
                                                                                              {
                                                                                                int i;
                                                                                                unsigned int removed = 0;
                                                                                                struct dog *dog = NULL;
                                                                                                struct sk_link *pos, *n, *end, *update[MAX_LEVEL];
                                                                                              
                                                                                                if (price_in_range(man, range))
                                                                                                  return 0;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward_safe(pos, n, end) {
                                                                                                    dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (!price_lte_max(dog->price, range)) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    } else if (price_gte_min(dog->price, range)) {
                                                                                                      /* Here's no break statement because we allow dogs with same price. */
                                                                                                      __abandon(man, dog, i + 1, update);
                                                                                                      removed++;
                                                                                                    }
                                                                                                  }
                                                                                                  update[i] = end;
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return removed;
                                                                                              }
                                                                                              
                                                                                              /* Abandon all the dogs with price rank in range
                                                                                               * where start and stop are inclusive. */
                                                                                              unsigned int
                                                                                              abandon_in_rank(struct man *man, unsigned int start, unsigned int stop)
                                                                                              {
                                                                                                int i;
                                                                                                unsigned int removed = 0, traversed = 0;
                                                                                                struct sk_link *pos, *n, *end, *update[MAX_LEVEL];
                                                                                              
                                                                                                if (start <= 0 || stop <= 0 || start > man->dog_num)
                                                                                                  return 0;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward_safe(pos, n, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (traversed + dog->link[i].span > stop) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    } else if (traversed + dog->link[i].span >= start) {
                                                                                                      /* Here's no break statement because we allow dogs with same price. */
                                                                                                      __abandon(man, dog, i + 1, update);
                                                                                                      removed++;
                                                                                                      continue;
                                                                                                    }
                                                                                                    traversed += dog->link[i].span;
                                                                                                  }
                                                                                                  update[i] = end;
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return removed;
                                                                                              }
                                                                                              
                                                                                              /* Get the dog price rank */
                                                                                              unsigned int
                                                                                              price_rank(struct man *man, int price)
                                                                                              {
                                                                                                int i;
                                                                                                unsigned int rank = 0;
                                                                                                struct sk_link *pos, *end;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward(pos, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (dog->price > price) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    } else if (dog->price == price) {
                                                                                                      return rank + dog->link[i].span;
                                                                                                    }
                                                                                                    rank += dog->link[i].span;
                                                                                                  }
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return 0;
                                                                                              }
                                                                                              
                                                                                              /* Find the dog with specified price. */
                                                                                              struct dog *
                                                                                              find_by_price(struct man *man, int price)
                                                                                              {
                                                                                                int i;
                                                                                                struct sk_link *pos, *end;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward(pos, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (dog->price == price) {
                                                                                                      return dog;
                                                                                                    } else if (dog->price > price) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    }
                                                                                                  }
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return NULL;
                                                                                              }
                                                                                              
                                                                                              /* Find the dog with specified price rank. */
                                                                                              struct dog *
                                                                                              find_by_rank(struct man *man, unsigned int rank)
                                                                                              {
                                                                                                int i;
                                                                                                unsigned int traversed = 0;
                                                                                                struct sk_link *pos, *end;
                                                                                              
                                                                                                if (rank == 0 || rank > man->dog_num)
                                                                                                  return NULL;
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward(pos, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    if (rank == traversed + dog->link[i].span) {
                                                                                                      return dog;
                                                                                                    } else if (traversed + dog->link[i].span > rank) {
                                                                                                      end = &dog->link[i];
                                                                                                      break;
                                                                                                    }
                                                                                                    traversed += dog->link[i].span;
                                                                                                  }
                                                                                                  pos = end->prev;
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              
                                                                                                return NULL;
                                                                                              }
                                                                                              
                                                                                              void
                                                                                              print(struct man *man)
                                                                                              {
                                                                                                int i;
                                                                                                struct sk_link *pos, *n, *end;
                                                                                                unsigned int traversed = 0;
                                                                                              
                                                                                                printf("\nTotal %d dogs: \n", man->dog_num);
                                                                                              
                                                                                                i = man->level - 1;
                                                                                                pos = &man->collar[i];
                                                                                                end = &man->collar[i];
                                                                                              
                                                                                                for (; i >= 0; i--) {
                                                                                                  traversed = 0;
                                                                                                  pos = pos->next;
                                                                                                  sklist_foreach_forward_safe(pos, n, end) {
                                                                                                    struct dog *dog = sklist_entry(pos, struct dog, link[i]);
                                                                                                    traversed += dog->link[i].span;
                                                                                                    printf("level:%d price:0x%08x rank:%u\n", i + 1, dog->price, traversed);
                                                                                                  }
                                                                                                  pos = &man->collar[i];
                                                                                                  pos--;
                                                                                                  end--;
                                                                                                }
                                                                                              }
                                                                                              
                                                                                              int
                                                                                              main(void)
                                                                                              {
                                                                                              #define NUM 1024 * 1024
                                                                                              
                                                                                                struct man *man;
                                                                                                struct dog *dog;
                                                                                                int i;
                                                                                                int *price;
                                                                                              
                                                                                                // Hello man!
                                                                                                man = man_birth();
                                                                                                if (man == NULL)
                                                                                                  exit(-1);
                                                                                              
                                                                                                printf("You wanna adopt %d dogs...\n", NUM);
                                                                                              
                                                                                                // Insert test.
                                                                                                for (i = 0; i < NUM; i++) {
                                                                                                  adopt(man, i + 1);
                                                                                                }
                                                                                              
                                                                                                printf("Now you are playing with dog NO.1111.\n");
                                                                                              
                                                                                                // Search test 1.
                                                                                                dog = find_by_price(man, 1111);
                                                                                                if (dog != NULL) {
                                                                                                  printf("It is the %dth dog you have adopted.\n", price_rank(man, 1111));
                                                                                                } else {
                                                                                                  printf("No.1111 not found.\n");
                                                                                                }
                                                                                              
                                                                                                // Search test 2.
                                                                                                printf("Now playing with the 1314th dog you have adopted.\n");
                                                                                                dog = find_by_rank(man, 1314);
                                                                                                if (dog != NULL) {
                                                                                                  printf("NO.%d is right licking your face.\n", dog->price);
                                                                                                } else {
                                                                                                  printf("No.1314 not found\n");
                                                                                                }
                                                                                              
                                                                                                printf("So you are always be alone with your dogs...\n");
                                                                                              
                                                                                                // Goodbye man!
                                                                                                man_kill(man);
                                                                                              
                                                                                                return 0;  
                                                                                              }
                                                                                              
                                                                                                • 2
                                                                                                • 新人请关照
                                                                                                # language: php
                                                                                                

                                                                                                interface IBachelor {

                                                                                                /**
                                                                                                 * 寻找自己所爱的人
                                                                                                 *
                                                                                                 * @author Paul Wang
                                                                                                 * @return mixed
                                                                                                 */
                                                                                                function findLover();
                                                                                                

                                                                                                }

                                                                                                class Bachelor implements IBachelor {

                                                                                                public function findLover()
                                                                                                {
                                                                                                    while (1) {
                                                                                                        $girl_position = rand(1, 100); // 女孩出现的位置
                                                                                                        $boy_position  = rand(1, 100); // 男孩出现的位置
                                                                                                
                                                                                                        if ($boy_position == $girl_position) {
                                                                                                            print "愿得一人心,白首不相离!\n";
                                                                                                            break;
                                                                                                        }
                                                                                                
                                                                                                        print "茫茫人海中寻找你...\n";
                                                                                                    }
                                                                                                }
                                                                                                

                                                                                                }

                                                                                                $jack = new Bachelor();
                                                                                                $jack->findLover();

                                                                                                  • 1
                                                                                                  • 新人请关照

                                                                                                  愚蠢的地球人,双十一,真正独立的单身狗哪会写代码。
                                                                                                  去犒劳自己了,你们接着玩。。。

                                                                                                  该答案已被忽略,原因:

                                                                                                    撰写回答

                                                                                                    登录后参与交流、获取后续更新提醒

                                                                                                    相似问题
                                                                                                    社区建设
                                                                                                    合作问答

                                                                                                    欢迎来到 SegmentFault 0x 社区建设。这里可以讨论有关 SegmentFault 的一切,帮助我们改进产品、完善社...

                                                                                                    推荐文章