已知,中华人民共和国的纸币面额分别为:100元、50元、20元、10元、5元、2元、1元,输入钱数,输出最小的货币方案。int main(){ int value[7] = { 100, 50, 20, 10, 5, 2, 1 }, count[7], change; int i, j,...
分类:
其他好文 时间:
2014-07-30 20:29:14
阅读次数:
167
很典型的线段树,注意就是一个数字如果变成了斐波那契数字之后如果在change的话,它是不会反生改变的,因为最近的斐波那契数字就是它本身了啊。
用一个flag表示这一段上的数字是否change过,如果flag == 1已经change过,就不会在向下更新。否则的话就进行更新,最后会到达一个节点,更新这个节点。这里用暴力更新就行,找到最近的斐波那契数字。
Add就是一个点更新,sum求和就是一个区...
分类:
其他好文 时间:
2014-07-30 10:07:43
阅读次数:
438
n个点,每个初始值为零,m个操作,共三种操作:
1 k d - "add"
2 l r - "query sum"
3 l r - "change to nearest Fibonacci"
1 ≤ n ≤ 100000, 1 ≤ m ≤ 100000, |d| < 231...
分类:
其他好文 时间:
2014-07-30 10:03:53
阅读次数:
246
题意:用所给的硬币面值构成所需的面值
思路:因为所用硬币数量不限,所以很容易想到完全背包。
递推:
#include
#include
#include
#include
using namespace std;
const int MAXN = 10005;
int n;
int coin[] = {1, 5, 10, 25, 50};
long long d...
分类:
其他好文 时间:
2014-07-29 15:02:39
阅读次数:
214
下载apache2.2 http server,安装next,见到set type,选择custom类型安装,change改变安装路径,next到finsh安装完成,默认80端口,打开浏览器http://localhost,show view "it works !"成功安装。 配置环境变量...
分类:
其他好文 时间:
2014-07-29 11:23:36
阅读次数:
244
问题:横竖屏切换时Activity的生命周期?答案:1、不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次2、设置Activity的android:configChanges=”orientation”时,切屏还是...
分类:
移动开发 时间:
2014-07-27 22:20:59
阅读次数:
271
Moving TablesThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building who...
分类:
其他好文 时间:
2014-07-26 14:22:30
阅读次数:
263
Hydrolink v9.52 for Maxsurf(数据交换模块)Section Maker v8.51 for Maxsurf(结构设计)Steel Designeer v8.51 for Maxsurf(钢结构设计) AutoYacht.8.2.0(Autoship公司的供快艇设计者使用的外...
分类:
其他好文 时间:
2014-07-26 14:05:05
阅读次数:
304
If you have lost or forgot root password of RHEL7, you can follow this step to change to a new password, this is different with the RHEL6 single-user mode...
分类:
其他好文 时间:
2014-07-26 02:49:36
阅读次数:
276
1、How Do I change extension of php file RewriteEngine?On
RewriteCond?%{REQUEST_FILENAME}?!-f
RewriteRule?^(.*)\.html$?$1.php?[L]...
分类:
其他好文 时间:
2014-07-25 11:39:41
阅读次数:
255