Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么做才能不tle呢?In Reply To:Re:怎么做才能不tle呢? Posted by:bobpkuhj at 2004-06-27 11:14:42 正解 对于方程 11 x + y = n; y是个位数. if n % 11 == 10; 方程无解 int posn(int n) { int y = n % 11; int x = n / 11; return y < 10 ? 10 * x + y : -1; } 然后枚举不同数所在位置 base = 10; while (base <= n) { int tn = n / base; int last = n % base; r = posn(tn); r = r * base + last / 2; if (r*2 > n) fill(a,t,r); r = posn(tn - 1); r = r * base + (last + base) / 2; if (r*2 > n) fill(a,t,r); base *= 10; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator