C++
文章平均质量分 68
xia_xiao_mo
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++中double型数据的取模运算
double型数据的取模运算1.计算思路 由于double型数据存在精度问题,所以不能以往常的思想解决---即取得 n = kp + r;这里我的思路是将double型数据放大后转为int型数据取模,然后再缩小为放大的倍数。2.double型数据转换为字符串 因为我们需要知道放大的倍数,所以必须知道小数点后有多少位,这里我的想法是将double型数据转为为字符串原创 2014-12-03 15:17:54 · 12950 阅读 · 0 评论 -
最长子序列
描述A numeric sequence of ai is ordered if a1 a2 < ... aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 i1 i2 < ... iK N. F原创 2014-10-16 20:52:17 · 689 阅读 · 0 评论 -
大数加法
大数加法要点:翻转数字串数字字符相加 数字转换成字符带进位相加#include #include #include using namespace std;//不定长度参数加法int charAdd(char first,...){ int sum=0; char i=first; va_list args; va_start(args,f原创 2015-03-05 10:44:50 · 487 阅读 · 0 评论 -
大数计算
完整的大数计算:http://blog.youkuaiyun.com/hackbuteer1/article/details/6595881转载 2015-03-05 10:59:32 · 487 阅读 · 0 评论 -
矩阵二分乘法
矩阵二分乘法1.非递归的矩阵二分乘法#include #include #define MOD 10000#define LENGTH 2//矩阵p*q,并将结果存放到p中void matrix_mul(int p[LENGTH][LENGTH],int q[LENGTH][LENGTH]){ int t[LENGTH][LENGTH]={0}; //中间数组 f原创 2015-03-18 14:25:52 · 979 阅读 · 2 评论 -
逻辑运算实现位向量
1.位向量的含义位向量指的是由一些二进制位组成的向量,包含位向量的设置,清零以及探测功能,例如:如果有1,2,4,5这几个数组,则需要二进制数110110表示。现在需要用32位的int型数据的每一位表示一个数据,因为正常情况下数据范围大于32,所以需要int数组来表示,即a[0]表示0-31,a[1]表示32-63,以此类推。2.代码实现#define N 10000000原创 2016-06-20 08:35:38 · 834 阅读 · 0 评论 -
编程珠玑——字符串移位
1.题目描述讲一个n圆一维向量向左旋转i个位置。例如,当n=8且i=3时,向量abcdefgh旋转为defghabc。现在要求在O(n)的时间复杂度,且空间复杂度为O(1)。2.算法2.1字符串逆序解决例如:当n=8且i=3时,向量为abcdefgh。先旋转前3个字符得到cbadefgh,再转换后5个字符得到cbahgfed,最后旋转整个字符串得到defghabc。//翻转字符原创 2016-06-21 21:20:38 · 619 阅读 · 1 评论 -
POJ3273——Monthly Expense
DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤原创 2016-12-02 10:08:56 · 369 阅读 · 0 评论 -
POJ3122——pie
DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my p原创 2016-12-03 10:56:16 · 354 阅读 · 0 评论
分享