Lien's blog

By Lien, 10 years ago, In English

Hi,

I am trying to solve this problem but it is hard to find a possible approach. Could somebody help me?

Problem:

Let you have a rectangle cake. You want to divide it to N people. All of them must eat all piece of the cake and they have equally area. What is the minimum number of parallel cut you need to take.

Example:

Divide the cake for 5 people you need at least 3 cut: 2 horizontal cuts the cake into 3 parts: 2/5 and 2/5 and 1/5. Then with 1 vertical cut, the cake is divided into 6 parts: 4 piece2 1/5 and 2 pieces 1/10. Join 2 pieces 1/10, you have divided the cake equally for 5 people.

There is no limitation for N in this problem. However, I hope someone can show me an approach for 1 <= N <= 100000.

Full text and comments »

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

By Lien, 11 years ago, In English

Hi all, today I found a very intesting prime sieve when I coding spoj PAGAIN: https://github.com/zobayer1/SPOJ/blob/master/PAGAIN.cpp The sieve is very fast and save memory but I can't understand what this code working:

#define ifC(n) (flag[n>>6]&(1<<((n>>1)&31)))
#define isC(n) (flag[n>>6]|=(1<<((n>>1)&31)))

Can anyone help me prove it?

Full text and comments »

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

By Lien, 11 years ago, In English

Hi all, i am begin learnig how to use github. I want to creat some folders inside a repository like ftiasch github . In his "acm-icpc" repository have many folders. Example i want create folder "number theory" in "math" repository but i can only add some .txt or .cpp file in it, can anyone help me?

Full text and comments »

Tags git
  • Vote: I like it
  • -18
  • Vote: I do not like it

By Lien, 11 years ago, In English

Hi all, I am now learning about lexicography in my school. It seem very interesting but not unusual in contests. I need your help of finding lexicography problems in any sources and I'd appreciate if you give some hints for the problem. Thank you for your help!

Full text and comments »

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

By Lien, 11 years ago, In English

Hi! I'm now thinking about calculate geometric sum: 1+a+a^2+..+a^n mod m where a,m,n are 64-bit integer. I transform 1+a+a^2+...+a^n mod m=(a^(n+1)-1)/(a-1) mod m but a new problem appear: when gcd(a-1,m)>1 it seem impossible to find t such that t*(a-1) mod m=1. Any hint for this problem?

Full text and comments »

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

By Lien, 12 years ago, In English

Now IOI 2012 is running the scoreboard is here And in order to view more information about a contestant you can click his/her name

Full text and comments »

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