自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 C++小问题之string 变为 int

这是leetcode 中遇到的一个纠结了很久的问题,试过几种,总结如下: int a=247; char c[10]; string b 方法一:使用sprintf_s(或sprintf) sprintf_s(c,"%d",a); string b(c); 在VS中使用sprintf会有一个warning,并且建议采用sprintf_s。 用哪个还是看情况吧,(leetcod

2015-03-17 17:08:28 534

原创 LeetCode之Rotate Array(C++)

Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note: Try to come up as many solutions as you can, ther

2015-03-17 16:12:45 474 1

原创 LeetCode 之Largest Number(C++)

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be very large,

2015-03-17 15:55:35 489 1

原创 堆排序以及优先队列

算法导论中的堆排序。 主要的几个函数:三个宏用来表示取父节点和左右子节点,算法导论讲的很详细实现很简单 #define PARENT(i)(i/2) #define LEFT(i)(2*i) #define RIGHT(i)(2*i+1) class Numbersort { public: Numbersort() { arry=NULL; n

2015-03-10 22:08:12 512 1

原创 POJ——1001 Exponentiation 解题思路

Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many compu

2015-03-09 17:08:26 657 1

原创 大饼的排序

来源于编程之美的一摞烙饼的排序。2种实现思路: 1. 从底层开始排序 2. 从上面开始排序 从上面排序分三种情况,不翻转,翻转一次,翻转3次(最开始以为是2次●0●)。这样看第一种最优,但是第二种是首先想到的方法,所以也进行了实现。菜鸟很菜的一个程序,写出来安慰一下自己:我有做过(一种悲伤的气氛)。 下面是完整的算法,其中run()是第二种,runbottom是第一种。 class

2015-03-09 16:35:06 501 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除