TCHS SRM 50 250 pt - Level one - Funny Birds editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm50
TCHS SRM 50 250 pt - Level one - Funny Birds solution:
#include <iostream> class FunnyBirds{ public: int gameTime(int n) { int a=1, cnt=0; while(n) { while((a*(a+1)/2)<=n) a++; a--, n-=a*(a+1)/2, cnt+=a, a=1; } return cnt; } };
No comments:
Post a Comment