- 博客(35)
- 收藏
- 关注
转载 静态代码块与构造代码块
主类package com;public class APP { public static void main(String [] args) { Fouzhao z=new Fouzhao(); z.Fouz(); Fouzhao z2=new Fouzhao(); z2.Fouz(); new Fouzhao().Fouz(); }}...
2019-08-03 16:46:54
264
转载 Syntax error, parameterized types are only available if source level is 1.5
1.在新建项目的时候会出现这种错误:Syntax error,parameterized types are only avaliable if source level is 1.5,这是因为jdk1.5之前不支持泛型或其他属性,应该是IDE配置的问题。主要从两个方向下手:(1)jdk版本是不是1.5以上。(2)在IDE的版本也需要修改。1.右击项目-->properties-->j...
2019-08-01 15:13:22
295
原创 灵感和实践
爱迪生说过,“天才是百分之九十九的汗水加上百分之一的灵感,但是这百分之一的灵感要比百分之九十九的汗水重要得多。”这充分说明了灵感的重要性,没有灵感的努力是不够的。然而,灵感的出现是有条件的。行动是灵感的重要来源。很多时候,我们做一件事情时很久都没有成果,但是在某一刻灵感却突然出现在我们的脑海中。这其实说明了灵感是来源于丰富的实践。 众所周知,牛顿因为苹果砸在头上才发现了万有引力。但很多...
2018-06-13 20:41:58
556
原创 hdu 3549 Flow Problem
注意:起点与终点相同时的情况方法一.邻接矩阵#include <iostream>#include<queue>#include<stdio.h>#include<string.h>using namespace std;const int INT=1000000005;const int maxx=105;int map1[maxx]...
2018-06-03 10:16:26
173
原创 贝壳找房性价比(2018 计蒜之道 初赛 第三场)
贝壳找房有一个性价比比较的系统,对于两个房源 aa,bb,aa 的价格为 p_apa 万元,面积 s_asa 平方米,bb 的价格为 p_bpb 万元,面积为 s_bsb 平方米。他们的绝对性价比差定义成为 \displaystyle \frac{|p_a - p_b|}{|s_a - s_b|}∣sa−sb∣∣pa−pb∣。现在给出 nn 个房源的价格和面积,请你求出一对房源使...
2018-05-19 20:04:35
280
原创 词法分析器(简单)
#include <iostream>#include<string.h>#include<stdio.h>using namespace std;string ba[5]= {"while","if","else","switch","case"};//关键字表int hash1[305]= {};string
2018-05-19 11:14:50
912
1
原创 指针数组的输入
#include<iostream>#include<stdio.h>#include<string.h>#include<math.h>#include<string.h>#include<stdlib.h>using namespace std;int main(){ char *a[10]; ...
2018-05-12 10:33:10
4290
原创 (搜索应用)Oil Deposits( UVA - 572 )
Oil Deposits UVA - 572 #include <iostream>#include<stdio.h>#include<queue>#include<stdlib.h>#include<string.h>using namespace std;char a[100][100];int vis[100][100...
2018-04-15 19:12:14
138
原创 Java求大数的n 次方(hdu1063)
ExponentiationTime Limit: 2000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10551 Accepted Submission(s): 3081Problem DescriptionProblems involving the comp...
2018-04-12 19:06:48
1485
原创 hdu1002 大数加法(java)
A + B Problem IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 409774 Accepted Submission(s): 79404Problem DescriptionI have a very simple p...
2018-04-10 20:58:54
177
原创 (搜索)Tempter of the Bone((HDU - 1010)
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone ...
2018-04-02 19:27:09
190
原创 N皇后问题
N皇后问题 HDU - 2553 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input共有若干行,每行一个正整数...
2018-03-30 21:00:36
185
原创 回溯法应用——背包问题
题目描述:假设我们有n件物品,分别编号为1, 2...n,有一个背包,它能够承载的重量是W。其中编号为i的物品价值为vi,它的重量为wi。现在,我们希望往包里装这些物品,使得包里装的物品价值最大化,那么我们该如何来选择装的东西呢?#include <iostream>#include<cstdio>#include<string.h>using names...
2018-03-28 18:59:40
298
原创 杭电acm1027全排列(回溯算法)
Problem DescriptionNow our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has to beat our hero first. f...
2018-03-28 15:04:27
457
原创 T95要减肥(动态规划)
链接:https://www.nowcoder.com/acm/contest/79/B来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld题目描述 T95提速啦,然而她觉得自己还是太慢了! 于是T95决定减肥——然而T95还喜欢吃麦当劳 现在有n种赛道,n家麦当劳,第i条赛道的痛...
2018-03-24 14:40:29
255
原创 (搜索)POJ-1979 Red and Black
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can'...
2018-03-24 14:24:34
158
原创 顺序表
#include#include#include#includeusing namespace std;#define sizelist 100#define listincrease 10#define error -1#define ok 0typedef struct{ int *data; int length; int listsize;}
2017-11-24 20:37:20
181
原创 桶排序
#include#include#include#includeusing namespace std;int main(){ int *p,q[10005]; int n; p=new int[10005]; memset(q,0,sizeof(q)); cout<<"输入序列长度:"<<endl; cin>>n; int i=
2017-11-22 20:28:49
165
原创 直接插入排序
#include#include#includeusing namespace std;typedef struct{ int *r; int length;} sqlist;void createlink(sqlist &L){ int n; L.length=0; cout<<"输入链表长度:"<<endl; cin>>n;
2017-11-22 20:14:16
184
原创 折半排序
#include#include#includeusing namespace std;typedef struct{ int *r; int length;} sqlist;void createlink(sqlist &L){ int n; L.length=0; cout<<"输入链表长度:"<<endl; cin>>n;
2017-11-22 20:10:02
242
原创 快速排序
#include#include#includeusing namespace std;typedef struct{ int *r; int length;} sqlist;void createlink(sqlist &L){ int n; L.length=0; cout<<"输入链表长度:"<<endl; cin>>n;
2017-11-22 20:02:37
176
原创 希尔排序
#include#include#includeusing namespace std;typedef struct{ int *r; int length;} sqlist;void createlink(sqlist &L){ int n; L.length=0; cout<<"输入链表长度:"<<endl; cin>>n;
2017-11-22 19:52:44
248
原创 堆排序
#include#include#includeusing namespace std;typedef struct{ int *r; int length;}sqlist;void createlink(sqlist &L){ int n; L.length=0; cout<<"输入链表长度:"<<endl; cin>>n;
2017-11-22 19:36:25
217
原创 循环链表应用之约瑟夫环
#include#include#includeusing namespace std;typedef struct node{ char data; struct node *next;}slink,*ad;ad createlink(slink *head){ slink *p,*s; int n; cout<<"输入链表长度:"<<en
2017-11-15 17:29:14
306
原创 循环链表
#include#include#includeusing namespace std;typedef struct node{ int data; struct node *next;}slink,*ad;ad createlink(slink *head){ slink *p,*s; int n; cout<<"输入链表长度:"<<end
2017-11-12 20:56:00
147
原创 运算符重载简单应用之分数四则运算
#include#includeusing namespace std;class fraction{ double molecular,denominator; public: void start() { char ch; cout<<"输入分数:"<<endl; cin>>molecular;
2017-11-12 15:39:23
346
原创 字符串搜索函数应用
字符串对比:题目说起来很简单,你会读到两个字符串,每个字符串占据一行,每个字符串的长度均小于10000字符,而且第一个字符串的长度小于第二个字符串的。你的程序要找出第一个字符串在第二个字符串中出现的位置,输出这些位置,如果找不到,则输出-1。注意,第一个字符的位置是0。注意,第一个字符串在第二个字符串中的位置可能不止一处。
2017-11-12 15:22:45
229
原创 求a^n的尾数
1.普通方法:#includeusing namespace std;int main(){ int a,n; cin>>a>>n; int i=0; int num=0; int a1=a; a=a%10; while(num<n-1) { a=a*a1; while(a>=10) a%=10; num++; } cout<<"a="<<a<<end
2017-10-21 14:29:58
283
原创 循环右移
循环右移k 位问题老师参与下面的算法(文字叙述形式),用来将数组a[n]的每个元素都循环地右移k位,这里1≤k≤n。算法描述如下:步骤1) 将数组分成两段,左段长为n-k,右段长为k。步骤2) 分别将两段逆转(即元素排列次序与原次序相反)。步骤3) 再数组元素整体逆转。提示,任一数组元素a[i]经算法处理后,其
2017-10-21 14:04:42
970
原创 二叉树求叶子数、树的高度
#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode{ char data; struct bitnode *lchild; struct bitnode *rchild;} bitnode,*sq;int r=0;bitnode *q;i
2017-10-16 14:06:07
428
原创 二叉树非递归层次遍历
#include#include#include#includeusing namespace std;#define status inttypedef struct node{ int data; struct node *next; struct node *lchild; struct node *rchild; struct node *front; struc
2017-10-16 09:32:36
278
原创 二叉树非递归遍历之中序遍历
#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode{ char data; struct bitnode *next; struct bitnode *lchild; struct bitnode *rchild;}linkstack,*sq
2017-10-14 20:01:35
173
原创 二叉树递归的创建及三种遍历(先序、中序、后序)
#include#include#include#includeusing namespace std;#define status inttypedef struct bitnode {int data;struct bitnode *lchild;struct bitnode *rchild;} bitnode,*sq;int r=0;bit
2017-10-13 19:12:54
579
原创 快速幂模板
#include #include using namespace std;int power2(int a, int b, int c){ int res = 1; a %= c; while (b) { if (b%2==1) res = (res * a) % c; a =
2017-10-13 15:32:17
170
原创 hihoCoder1040:矩形判断
时间限制:1000ms单点时限:1000ms内存限制:256MB描述给出平面上4条线段,判断这4条线段是否恰好围成一个面积大于0的矩形。输入输入第一行是一个整数T(1每组数据包含4行,每行包含4个整数x1, y1, x2, y2 (0 输出每组数据输出一行YES或者NO,表示输入的4条线段是否恰好围成矩形。样例输入30
2017-07-27 15:33:55
371
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人