- 博客(25)
- 收藏
- 关注
原创 魔兽终极版
#include <cstdio>#include <iostream>#include <cstring>using namespace std;int myHour, myMinute;int N, R, K;int draE, ninE, iceE, lionE, wolfE;int draF, ninF, iceF, lionF, wolf...
2018-04-29 15:07:45 364
原创 7w1
#include <iostream>using namespace std;template <class T>class CArray3D {public: static int size2, size1; class CArray1D { public: T * a1; CArray1D() { a1 = new T[size1]; } T...
2018-04-29 15:06:04 7949
原创 MyString类
#include <iostream>#include <cstring>#include <cstdlib>using namespace std;class MyString {private: char *s;public: MyString(const char *str) { s = new char[strlen(str) + 1...
2018-04-12 19:40:28 369
原创 poj 魔兽世界之二:装备
#include <iostream>using namespace std;int Hours = 0;string arm[] = { "sword", "bomb", "arrow" };class Dragon {public: float morale;//怒气 int weapon; static int strength;};class Ninja...
2018-04-12 19:30:46 1043
原创 魔兽世界之一:备战
#include <iostream>using namespace std;int tm = 0;bool flagRS = true, flagBS = true;//红军与蓝军停止标志class dragon {public: int total = 0; static int strength;};class wolf {public: int tota...
2018-04-12 19:30:21 1050
原创 poj 大整数的加减乘除
#include <iostream>#include <cstring>using namespace std;class CArray {public: int *p = NULL; int * init(int s) { if (p) delete[]p; p = new int[s]; return p; } ~CArray() ...
2018-04-12 19:29:58 534
原创 poj 走出迷宫
/*每个点分别朝四个方向走,先到的即为最短*/#include <iostream>using namespace std;struct dot{ int x; int y;};char s[100][100];int walk(char s[][100], int start, int si, int sj, int ti, int tj, int m, i...
2018-04-02 11:31:42 382
原创 poj 文字排版
#include <iostream>#include <string.h>#include <cstdio>using namespace std;int main() { int n, len = 0, maxlen = 80;//n为单词数, len记录当前读入的字符数, maxlen为每行允许输出的最大长度 cin >> n;...
2018-04-02 11:31:17 244
原创 poj 计算矩阵边缘元素之和
#include <iostream>using namespace std;int calculate(int (*p)[100], int m, int n) { int sum = 0; if (m <= 2 || n <= 2) {//两行或两列以下的矩阵直接计算和 for (int i = 1; i <= m; i++) for (int...
2018-04-02 11:30:55 265
原创 poj 括号匹配问题
#include <iostream>#include <cstdio>#include <string.h>using namespace std;void m(char s[], int flag[], int n) {//匹配函数 if (strlen(s) != n) { if (s[n] != ')') m(s, flag, n + 1...
2018-04-02 11:30:38 415
原创 poj 排队游戏
#include <iostream>#include <cstring>using namespace std;bool flag[100];//已匹配标志void match(char str[], int y) { while (str[y] == str[0]) y++; flag[y] = true;//女生匹配成功 int i = y - 1;...
2018-04-02 11:30:19 447
原创 poj 细菌实验分组
#include <cstdio>#include <cstdlib>struct my{ int id;//培养皿编号 double rate;//繁殖率};int cmp(const void* a, const void* b ) { return ((*(my *)a).rate > (*(my *)b).rate) ? 1 : -1;}i...
2018-04-02 11:29:29 321
原创 poj 单词翻转
#include <iostream>#include <cstring>using namespace std;int main() { char s[500]; cin.getline(s, 500); int i, j = 0, k; for (i = 0; s[i] != '\0'; i++) { if (s[i] != ' ') j++;//计算...
2018-04-02 11:29:07 199
原创 poj 单词排序
/*1、将字符串存入数组 2、字符串数组的快速排序算法*/#include <iostream>#include <string.h>using namespace std;void quick(char s[][200], int low, int high) {//字符串快排 if (low >= high) { return; } int f...
2018-04-02 11:28:49 188
原创 poj 矩阵归削减序列和
#include <iostream>#include <cstdio>using namespace std;int a[105][105];int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) ...
2018-04-02 11:28:01 218
原创 poj 字符串最大跨距
/*思路:1、从前查找字符S1最先出现的位置 2、从前查找S2最后出现的位置 3、计算两个位置的跨距*/#include <iostream>#include <string.h>using namespace std;int main() { char t[325], s[300] = "", s1[10] = "", s2[10] = "";//s,s1, ...
2018-03-29 14:24:59 350
原创 poj 单词倒排
#include <iostream>#include <string.h>using namespace std;int main() { char t[100][100] = {" "}; int n = 0; while (cin >> t[n]) { n++; } for (int i = n - 1; i >= 0; i--)...
2018-03-29 14:17:55 282
原创 poj 整数奇偶排序
#include <iostream>using namespace std;int cmp1(const void *a, const void *b) {//void指针类型做形参需重新定义类型 return *(int *)a - *(int *)b;}int cmp2(const void *a, const void *b) {//void指针类型做形参需重新定义类...
2018-03-29 14:13:05 363
原创 poj 错误探测
#include <stdio.h>int main() { int n; while (scanf("%d", &n) && n != 0) { int a[100][100], r1[100] = { 0 }, c1[100] = { 0 }; for (int i = 0; i < n; i++) { for (int j = 0...
2018-03-29 14:08:33 727
原创 poj 完美立方
#include <stdio.h>int main() { int N;//矩阵的阶数 scanf("%d", &N); for (int a = 6; a <= N; a++) { for (int b = 2; b < a; b++) { for (int c = b; c < a; c++) { for (int d = c;...
2018-03-29 14:06:49 315
原创 poj 第二次重复出现的数
#include <stdio.h>int main() { int m, n, num[500]; scanf("%d", &m); for (int i = 0; i < m; i++) { scanf("%d", &n); for (int j = 0; j < n; j++) { scanf("%d", &num[j
2018-03-29 14:05:29 240
原创 poj 分数求和
#include <iostream>using namespace std;int main() { int n, a, b, aSum, bSum;//分子为a,分母为b, aSum为分子和,bSum为分母和 aSum = bSum = 1; cin >> n; scanf("%d/%d", &a, &b); aSum = a; bSum...
2018-03-29 14:02:47 213
原创 poj 流感感染
#include <iostream>using namespace std;int num;//感染的人数void infect(char a[][102], int n) { num = 0; int col[10000] = { 0 }, row[10000] = { 0 }; for (int i = 1; i <= n; i++) { for (int...
2018-03-29 13:56:19 376
原创 poj 细菌实验分组
#include <cstdio>#include <cstdlib>struct my{ int id; double rate;};int cmp(const void* a, const void* b ) { return ((*(my *)a).rate > (*(my *)b).rate) ? 1 : -1;}int main() {...
2018-03-29 13:46:57 612
原创 poj 校门外的树
#include <iostream>using namespace std;int main() { int tree[10000] = {0}, l, m, s, e, remain = 0;//tree表示树,l为马路长度,m为区域个数, s为区域起点,e为区域终点,remain为剩余树的个数 cin >> l >> m; for (int i ...
2018-03-29 13:43:21 463
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人