我只能说好好的端午节你们不约么?,还在这里写代码?我也是够无聊的,下班了不走也在这跟风写着玩!《找女生要QQ号码原文》原文链接http://www.cnblogs.com/iforever/p/4584490.html 

题目:给了一串数字(631758924不是QQ号码),根据下面规则可以找出QQ号码:首先删除第一个数,紧接着将第二个数放到这串数字的末尾,再将第三个数删除,并将第四个数放到这串数字的末尾......如此循环,知道剩下最后一个数,将最后一个数也删除,按照刚才删除的顺序,把这些数字连在一起就是女神的QQ号码啦。

以下是C# 通过QQ(615947283)号码得到题目中数字

private string ReQQ(string QQ)
{
    string temp = "";
    temp = QQ.Substring((QQ.Length - 2), 1) + QQ.Substring((QQ.Length - 1), 1);
    while (temp.Length < QQ.Length)
    {
        temp = QQ.Substring((QQ.Length - temp.Length - 1), 1) + temp;
        temp = temp[0] + temp.Substring(temp.Length - 1) + temp.Substring(1, temp.Length - 2);
    }
    return temp;
}

顺便贴出获取QQ的方法

private string GetQQ(string Num) {//Num:631758924
    var temp = "";
    while (Num.Length > 1) {
        temp += Num[0];
        Num = Num.Substring(2) + Num[1];
    }
    return temp + Num;
}

 

相关文章:

  • 2021-11-25
  • 2021-10-04
  • 2022-12-23
  • 2022-01-18
  • 2021-10-04
  • 2021-06-13
  • 2021-12-02
  • 2022-01-03
猜你喜欢
  • 2021-10-20
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2022-02-10
  • 2021-07-15
相关资源
相似解决方案