搜索空间不过 \(1e4\) ,暴力 \(bfs\) 即可得到最少操作。 输出每次操作可能需要手动模拟栈,方便找到最优解后回溯输出。 /** * poj3414 Pots * */ #include <cstdio> #include <queue> #include <iostream> #inc ...
分类:
其他好文 时间:
2021-01-25 11:05:02
阅读次数:
0
张克清 冒泡排序和选择排序算法两个排序算法 、三个查找算法及测试程序 /*排序算法1、冒泡排序2、插入排序3、选择排序4、希尔排序5、归并排序6、快速排序7、堆排序8、基数排序*/int BubbleSort(int a[],int n){int i=0,j=0;int temp=0;for(i=0 ...
分类:
编程语言 时间:
2021-01-25 10:56:25
阅读次数:
0
数组的复制 注意:此复制不是赋值,是数组元素的复制 public class Hello { public static void main(String[] args){ String[] arr = new String[]{"jj","DD","MM","BB","GG","AA"}; //源 ...
分类:
编程语言 时间:
2021-01-22 12:13:14
阅读次数:
0
挺好想的二分题吧。 const int N=1e5+10; PII a[N]; int n,k; bool check(int mid) { int res=0; for(int i=0;i<n;i++) res+=(a[i].fi/mid)*(a[i].se/mid); return res>=k ...
分类:
其他好文 时间:
2021-01-22 12:03:44
阅读次数:
0
B - A Funny Bipartite Graph 参考题解:https://blog.csdn.net/cat_pikapikapi/article/details/103494593 二分图左部点和右部点个数都<=18 代价:$\sum M_i^{D_i}$ $M_i$是左部点的一个权值 $ ...
分类:
其他好文 时间:
2021-01-21 10:56:37
阅读次数:
0
题目链接:https://vjudge.net/problem/POJ-3278 Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediatel ...
分类:
其他好文 时间:
2021-01-19 12:20:23
阅读次数:
0
题目描述 Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. Follow up: The overall run time ...
分类:
其他好文 时间:
2021-01-19 12:12:17
阅读次数:
0
1. 二分查找 C++ STL标准库中提供有 lower_bound()、upper_bound()、equal_range() 以及 binary_search() 这 4 个查找函数,它们的底层实现采用的都是二分查找的方式。 1.1 lower_bound() lower_bound() 函数用 ...
分类:
其他好文 时间:
2021-01-18 11:23:23
阅读次数:
0
地址 https://vjudge.net/problem/POJ-3050 The cows play the child's game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes ...
分类:
其他好文 时间:
2021-01-18 11:21:11
阅读次数:
0
题目如下: 数轴上有 n (1 输入 第一行:N和T 第二行至N+1行: 每一行一个闭区间。 输出 选择的区间的数目,不可能办到输出 1 样例输入 3 10 1 7 3 6 6 10 样例输出 2 提示 这道题输入数据很多,请用scanf而不是cin 解题思路: 这题是一道非常简单的区间问题,利用贪 ...
分类:
其他好文 时间:
2021-01-15 12:03:02
阅读次数:
0