2015年10月3日

HDU2054 A==B?

摘要: 题目地址:HDU2054将读出的浮点数保存在字符数组中(声明大小或者new一个),除去前置零和小数点后的后置零,若小数点后数全为零,则连小数点一起去掉。 注意:去掉后置零时 *p--=0 的表达方式。代码:#include#include#includeusing namespac... 阅读全文

posted @ 2015-10-03 22:12 师者为王 阅读(127) 评论(0) 推荐(0) 编辑

HDU2058 The Sum Problem

摘要: 题目链接:HDU2058 题意:1-n 寻找子序列和为m如果二重循环求sum很容易TLE,故有以下分析:等差数列的求和公式:Sn=(a1+an)*n/2=(2*a1+(n-1)*d)*n/2 在此题中Sn=(2*a1+len)*(len+1)/2=m; 由此可得:a1=m/(l... 阅读全文

posted @ 2015-10-03 21:34 师者为王 阅读(120) 评论(0) 推荐(0) 编辑

CodeBlocks 项目基本配置基础

摘要: p { margin-bottom: 0.21cm; }a:link { }File 菜单New :新建( Empty file/file 、 class 、 project 、 build target ) 。 Recent projects/files :最近打开的项目 / 文... 阅读全文

posted @ 2015-10-03 20:14 师者为王 阅读(1675) 评论(0) 推荐(0) 编辑

组合数与错排数求解方法探析

摘要: 组合数: 我们都知道组合数C(m,n)的含义是从m个物品中选n个物品的方法种数,其冠以的数学求解表达式为: C(m,n)=m!/(n!*(m-n)!); 这个公式是显而易见的,并不难证明。 但是某些题目中利用阶乘求其组合数,会浪费很多的时间和空间,可... 阅读全文

posted @ 2015-10-03 14:35 师者为王 阅读(218) 评论(0) 推荐(0) 编辑

HDU2031 进制转换

摘要: 数制转换需要逆序输出,就需要用到栈。所以我们直接用递归调用了。#include#includeusing namespace std;void ttor(int n,int r){ if(n) { ttor(n/r,r); printf("%... 阅读全文

posted @ 2015-10-03 12:17 师者为王 阅读(119) 评论(0) 推荐(0) 编辑

浅析__int64与long long

摘要: //为了和DSP兼容,TSint64和TUint64设置成TSint40和TUint40一样的数 //结果VC中还是认为是32位的,显然不合适 //typedef signed long int TSint64; //typedef unsigned long int ... 阅读全文

posted @ 2015-10-03 11:24 师者为王 阅读(487) 评论(0) 推荐(0) 编辑

导航