梦希月翎吧 关注:107贴子:2,619
  • 4回复贴,共1
The Children’s Day has passed for some days .Has you
remembered something happened at your childhood? I remembered I often played a
game called hide handkerchief with my friends.
Now I introduce the game to
you. Suppose there are N people played the game ,who sit on the ground forming a
circle ,everyone owns a box behind them .Also there is a beautiful handkerchief
hid in a box which is one of the boxes .
Then Haha(a friend of mine) is
called to find the handkerchief. But he has a strange habit. Each time he will
search the next box which is separated by M-1 boxes from the current box. For
example, there are three boxes named A,B,C, and now Haha is at place of A. now
he decide the M if equal to 2, so he will search A first, then he will search
the C box, for C is separated by 2-1 = 1 box B from the current box A . Then he
will search the box B ,then he will search the box A.
So after three times he
establishes that he can find the beautiful handkerchief. Now I will give you N
and M, can you tell me that Haha is able to find the handkerchief or not. If he
can, you should tell me "YES", else tell me "POOR Haha".
I


1楼2013-09-15 22:10回复
    output:
    For each input case, you should only the result that
    Haha can find the handkerchief or not.
    对于每个输入情况下,您应该只结果,哈哈可以找到手帕或不是。


    4楼2013-09-15 22:12
    回复

      Sample Input
      3 2
      -1 -1
      Sample Output
      YES


      5楼2013-09-15 22:12
      回复

        求组合数
        十进制和二进制转换,int输出二进制
        猴子吃枣问题:猴子摘了一堆枣,第一天吃了一半,还嫌不过瘾,又吃了一个;第二天,又吃了剩下的一半零一个;以后每天如此。到第十天,猴子一看只剩下一个了。问最初有多少个枣子?
        楼梯有N级台阶,上楼可以一步上一阶,也可以一步上二阶。编一递推程序,计算共有多少种不同走法?
        用递归算法实现二分查找,即:有20个已经从小到大排序好的数据,从键盘输入一个数X,用对半查找方法,判断它是否在这20个数中。I


        来自百度影音浏览器8楼2013-09-20 12:01
        回复

          My_strlen
          #include<iostream>
          Int main{
          Char a;
          Gets(a);
          Int *p
          Int ans
          P=new int[];
          P=a;
          For(;*p;++P){
          Ans+=1;
          }
          Printf(“%d”,ans)
          }
          My_strcmp
          #……
          Int main()
          {
          Char a,b;
          Gets(a);
          gets(b);
          itn *p1,*p2;
          p1=a;
          p2=b;
          a=*p2;
          b=*p1;
          }
          My_strcat
          #......
          int main(){
          Char a,b;
          Int *p1,*p2;
          P1=a;
          P2=b;
          P1=new int[];
          C1=strlen(a)
          C2=Strlen(b)
          For(;I<c;++i, }
          {
          (P1[c1]+i)=p2+i
          }
          }I


          9楼2013-09-20 16:40
          回复