kphmd's blog

By kphmd, 9 years ago, In English

eg. 5

1 -> ? -> 5
2 -> ? -> 4
3 -> ? -> 3
4 -> ? -> 2
5 -> ? -> 1

Case1:

1 -> ? -> 5 -> ? -> 1 2 -> ? -> 4 -> ? -> 2

merge above

1 -> 2 -> 5 -> 4 -> 1

Case2:

3 -> 3 -> 3

Read more »

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

By kphmd, 9 years ago, In English


some tips about problem A a=2 b=3 c=4 total=18 O O O O O O O O O O O O O O O O O O `a=1` b=4 c=5 total=20 0:2 O:18 O O O O 0 O O O O O O O O O O 0 O O O O a=4 `b=1` c=6 total=24 0:6 O:18 0 0 O O O O 0 O O O O O O O O O O 0 O O O O 0 0 a=5 b=6 `c=1` total=30 0:12 O:18 0 0 0 0 0 0 O O O O O O O O O O O O O O O O O O 0 0 0 0 0 0

cout << (a+c-1)*(b+c-1)-c*(c-1) << endl;

You can see this submission 2013799.

Read more »

 
 
 
 
  • Vote: I like it
  • +9
  • Vote: I do not like it

By kphmd, 9 years ago, In English
 
 
 
 
  • Vote: I like it
  • -1
  • Vote: I do not like it

By kphmd, 10 years ago, In English
for the problem A
 f4 3 - 9 -
 f3 2 4 8 10
 f2 1 5 7 11
 f1 0 6 - 12

* every (m-1)*2 time span the elevate arrived floor s and go up
* every (m-1)*2 time span the elevate arrived floor s and go down

base time for each floor is:
up:      (s-1)
down: (m-1)+(m-s)

Read more »

 
 
 
 
  • Vote: I like it
  • -6
  • Vote: I do not like it

By kphmd, 10 years ago, In English

I guess the case "int(100*0.94) == 93" may be like this process:


         0.939999....
       _______________________
100 )94
        900
        ____
         400
         300
         _____
         1000
           900
           _____
          1000
            900
            _____
            1000
            ... ...

Read more »

 
 
 
 
  • Vote: I like it
  • +2
  • Vote: I do not like it

By kphmd, 10 years ago, In English

24 step :
0,0,0,1,0,0,0,1,0,0,0,1,2,0,0,0,1,0,0,0,1,0,0,0
---------------------------------------------------
0:
         +---+
         | 5 |
     +---+---+---+---+
     | 3 | 0 | 1 | 2 | ----->
     +---+---+---+---+
         | 4 |
         +---+
         +---+
         | 1 |
     +---+---+---+---+
     | 5 | 0 | 4 | 2 | 
     +---+---+---+---+
         | 3 |
         +---+
1:
         +---+
         | 5 |
     +---+---+---+---+
     | 3 | 0 | 1 | 2 | ----->
     +---+---+---+---+
         | 4 |
         +---+
         +---+
         | 5 |
     +---+---+---+---+
     | 0 | 1 | 2 | 3 | 
     +---+---+---+---+
         | 4 |
         +---+
2:
         +---+
         | 5 |
     +---+---+---+---+
     | 3 | 0 | 1 | 2 | ----->
     +---+---+---+---+
         | 4 |
         +---+
         +---+
         | 1 |
     +---+---+---+---+
     | 4 | 2 | 5 | 0 | 
     +---+---+---+---+
         | 3 |
         +---+

Read more »

 
 
 
 
  • Vote: I like it
  • +16
  • Vote: I do not like it

By kphmd, 10 years ago, In English
#define foreach(ite,sets) for(__typedef(sets.begin()) ite=sets.begin();ite!=sets.end();ite++)
Do you like this code?
gl & hf

Read more »

 
 
 
 
  • Vote: I like it
  • -17
  • Vote: I do not like it