自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 LCA最近公共祖先

Leetcode 236 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), ...

2019-04-27 11:57:43 127

原创 c++ int convert to string

1019 数字黑洞 (20 分) 给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的 6174,这个神奇的数字也叫 Kaprekar 常数。例如,我们从6767开始,将得到7766 - 6677 = 1089 9810 - 0189 =...

2019-03-15 18:03:26 559

原创 A1029 Median

1029 Median (25 分) Given an increasing sequence S of N integers, themedian is the number at the middle position. For example, the medianof S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9,...

2019-03-14 19:47:33 104

转载 树状数组

https://blog.csdn.net/Yaokai_AssultMaster/article/details/79492190#include <cstring>#include <cstdio>///用于区间求和int data[200002];int C[200002];int lb(int x)///lowbit 用来求二进制的末尾0的个数 求的...

2019-03-13 20:21:04 77

原创 A 1067 Sort swap(0)

1067 Sort with Swap(0, i) (25 分)Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use...

2019-03-12 13:39:06 109

原创 cmp函数写法扩展(实现一个cmp的多次比较)

struct node {int id;int grade;};bool cmp(struct node n1, struct node n2){if (n1.grade > n2.grade)return n1.grade > n2.grade;elsereturn n1.id > n2.id;}

2019-03-02 13:30:50 654

原创 带空格字符串输入:getline(cin, str);

PAT1077A1077 Kuchiguse (20 分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personalit...

2019-03-02 13:10:02 294

原创 时间类的题目可以使用字符串进行处理

1006 Sign In and Sign Out (25 分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the recor...

2019-02-28 21:11:06 64

原创 int-> string

int a = 19;stringstream ss;ss << a;string str = ss.str();cout << str;

2019-02-27 21:55:32 323

转载 PAT B1008

1008 数组元素循环右移问题 (20 分)一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?输入格式:每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(≥0);第2行输入N个整数,之间用空格分隔。输出格式:在一行中输出循环右移M位以后的整数序列,之间用空格分隔...

2019-02-26 21:17:58 99

原创 sscanf && ssprintf && 数组传参 && 结构体初始化 && 区分引用和指针

sscanf(str, “%d”, &n); //str->int(int only, if double->int(floor))sprintf(str, “%d”, n); //int->str(only int, if double->int(floor))

2019-02-25 20:39:54 260

原创 数组集成初始化汇总

1、迭代for循环2、 memset(a, 0, sizeof (a)) /*因为memset函数按照字节填充,所以一般memset只能用来填充char型数组,(因为只有char型占一个字节)如果填充int型数组,除了0和-1,其他的不能。因为只有00000000 = 0,-1同理,如果我们把每一位都填充“1”,会导致变成填充入“11111111”*/3、 int arr[...

2019-02-25 20:15:48 291

原创 First temp

This is my first tech-blog, hoping can witness my progress in coding

2019-02-25 20:04:14 74

空空如也

空空如也

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

TA关注的人

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