- 博客(9)
- 收藏
- 关注
原创 POJ1007
DNAsorting #include <iostream> #define maxn 51 #define maxm 100 char a[maxm][maxn]; using namespace std; void DNAsort(char a[maxm][maxn], int n, int m) { int co[maxm]; memset(co, 0, sizeof(co)...
2019-07-23 14:37:26 156
原创 POJ1005
题:http://poj.org/problem?id=1005 #include<iostream> using namespace std; #define maxn 100000 double ero[maxn]; #define pi 3.141592654 int main() { for (int i = 0; i < maxn; i++) {...
2019-07-23 14:34:50 148
原创 POJ1004
include<iostream> using namespace std; int main() { double mycount[12], a=0; for (int i = 0; i < 12; i++) { cin >> mycount[i]; } for (int i = 0...
2019-07-23 14:33:27 96
原创 POJ1003
题:http://poj.org/problem?id=1003 #include<iostream> #define maxn 1000005 double a[maxn]; using namespace std; int hangover( double x) { int i; for (i = 1; i < maxn; i++) a[i] = a[i - 1] +...
2019-07-23 14:31:02 88
转载 POJ 1002
Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University o...
2019-07-18 10:32:22 133
转载 POJ 1001
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...
2019-07-16 15:47:12 181
原创 POJ 翻转卡片
分析:根据题目要求可知:全局正面朝上=所有的局部正面朝上。这也意味着贪心+递归是解题核心思路,即所有局部正面朝上构成了整体正面朝上。 #include<iostream> #include<stdio.h> using namespace std; bool a[1000][1000]; int N, M; int num = 0; void f(int x) { if...
2019-07-14 09:36:22 240
原创 KMP
include<iostream> using namespace std; int *buildNext(char *P) { size_t m = strlen(P), j = 0; int *N = new int[m]; int t = N[0] = -1; while (j < m - 1) { if (0 > t || P[j] == P[t]) ...
2019-07-10 10:39:48 90
原创 快速排序
快速排序算法是分治策略的典型应用,主要利用轴点将待排序序列分为两段序列,且轴点左侧序列的元素值不大于轴点元素值,轴点右侧序列的元素值不小于轴点元素值。然后在分别在两侧在寻找自身轴点,如此反复递归,直到递归逐层返回有序序列,最终组成一整个有序序列。**由此,可知其算法核心为为如何定位轴点。**C++代码如下所示: 在这里插入代码片 ...
2019-07-10 10:33:45 100
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人