A.Duff and Weight Lifting(思维) 显然题目中只有一种情况可以合并 2^a+2^a=2^(a+1).我们把给出的mi排序一下,模拟合并操作即可. # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <sta…
B. Pasha and PhonePasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly n digits. Also Pasha has a number k and two sequences of length n / k (n is divisible by k) a1, …
在看strcpy.memcpy等的实现发现用了内存对齐,每一个word拷贝一次的办法大大提高了实现效率,参加该blog(http://totoxian.iteye.com/blog/1220273). duff's device也是利用了类似的原理减少比较的次数来提高了效率. 前几天在网上看见了一段代码,叫做“Duff's Device”,后经验证它曾出现在Bjarne的TC++PL里面: void send( int * to, int * from, int count) …
Long Live the Queen Time Limit:250MS Memory Limit:4096KB 64bit IO Format:%I64d & %I64u Description The Queen of Byteland is very loved by her people. In order to show her their love, the Bytelanders have decided to conquer a new country which…