代码中遇到字符串常量的时候,编译器会使用该值创建一个String对象。字符串连接可以用concat方法,也可以用运算符 +。 创建格式化字符串:可以用printf方法和format方法。String类使用静态方法format返回一个String对象而不是PrintStream对象。String类的静 ...
分类:
编程语言 时间:
2020-07-17 09:33:48
阅读次数:
59
原文地址:https://www.cnblogs.com/Cloudcan/p/13326550.html 遵循两条原则:1.某出栈元素之后出栈的各元素,若比其小(即在原队列中先进栈),必须为从大到小排序(即倒序);2.最大的倒序数列,其元素数目不可以超过栈大小。例如5 6 4 3 7 2 1,最大 ...
分类:
其他好文 时间:
2020-07-17 09:25:45
阅读次数:
68
p++、*p++、*(p++)是在p所指向的地址上加1。 1 //*(p++)等同于*p++ 2 #include<stdio.h> 3 int main(void) 4 { 5 int *p; 6 int a[5]={1,4,3,2,5}; 7 p=a; 8 printf("首地址p是%p\n", ...
分类:
其他好文 时间:
2020-07-17 09:18:05
阅读次数:
88
游戏「并查集」 题目描述 Mirko和 Slavko 爱玩弹球戏。在一个令人激动的星期五,Mirko 和 Slavko 玩了一把弹球游戏。Mirko 构建一个有向图,所有顶点最多有 1 条出边。弹球从 1个顶点出发可以沿着一条边移动到它的邻接点,只要它存在,而且它会继续移动到后者的邻接点去,直到最后 ...
分类:
其他好文 时间:
2020-07-16 22:01:22
阅读次数:
76
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805363914686464 模拟题,新改的测试数据需要long double型,如果测试点3无法通过,可以参考以下代码: #include<bits/stdc++ ...
分类:
其他好文 时间:
2020-07-16 12:08:19
阅读次数:
60
1.区间求和 2.区间取模 3.单点修改 线段树,区间取模加一个剪枝:区间最大值<mod,不修改。其他单点取模 #include <bits/stdc++.h> using namespace std; #define debug printf("bug!!!\n"); typedef long l ...
分类:
其他好文 时间:
2020-07-16 11:50:06
阅读次数:
63
一个数最多能取8-9次根号。 #include <bits/stdc++.h> using namespace std; #define debug printf("bug!!!\n"); typedef long long ll; const int MAXN=1e5+10; const ll M ...
分类:
其他好文 时间:
2020-07-16 10:11:53
阅读次数:
74
##题目大意 用栈的形式给出一棵二叉树的建立的顺序,求这棵二叉树的后序遍历 ##tips string用printf输出:printf(“%s”, str.c_str()); ##AC代码 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #inc ...
分类:
其他好文 时间:
2020-07-15 22:48:44
阅读次数:
44
输出二叉树中的叶子结点 void PreOrderPrintLeaves( BinTree BT ) { if( BT ) { if ( !BT-Left && !BT->Right )// 在二叉树的遍历算法中增加检测结点的“左右子树是否都为空”。 printf(“%d”, BT->Data ); ...
分类:
其他好文 时间:
2020-07-15 15:28:16
阅读次数:
72
二分图最大匹配: 匈牙利算法 邻接表O(mn): #pragma GCC optimize(2) #include <bits/stdc++.h> using namespace std; const int maxn = 1010; const int maxm = 2e5; int n, m, ...
分类:
其他好文 时间:
2020-07-14 21:42:51
阅读次数:
67