自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(61)
  • 收藏
  • 关注

原创 考研用模板

bellman_fordbellman_ford#include<iostream>#include<cstdio>using namespace std; #define MAX 0x3f3f3f3f#define N 1010int nodenum, edgenum, original; //点,边,起点 typedef struct Edge //边{ int u, v; int cost;}Edge; Edge edge[N];int d

2020-07-12 20:39:36 167

转载 用IDEA创建我的第一个程序

这个过程真是坎坷,我就是配置不好,直到https://www.jianshu.com/p/8d49d36a3c7e。大家如果也不会配置的话去看看吧

2019-05-10 20:35:53 198

原创 7-28 搜索树判断 (25 分)

题目链接这是一个二叉搜索树的题,看以前写的代码,当初竟然不知道OJ上提交java代码不能带包,有点折。这个题写了好久,感觉挺简单的(写完之后确实挺简单的),值是过程有点不大好,一开始理解错题意了。因为理解错题意了,后来就改代码,改的很乱,很乱。思路:就是建两棵树,一棵树是普通二叉树(左子树严格小于,右子树大于等于),另一棵树是题目中的镜像二叉树,然后比较两次就可以了。imp...

2018-11-10 22:12:32 560

原创 7-51 两个有序链表序列的合并 (20 分)

java最后一个点超时,日;尽力了#include &lt;iostream&gt;#include &lt;cstring&gt;#include &lt;string&gt;#include &lt;algorithm&gt;using namespace std;const int long long N=1e8;int a[N],b[N];int main(){ l...

2018-11-06 19:25:52 1616

原创 7-14 电话聊天狂人 (25 分)

题目链接java超内存一点#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;string&gt;#include &lt;map&gt;using namespace std;int main(){ map&lt;string,int&gt; mp ; int n,maxn=-999; ...

2018-11-02 13:02:07 918 1

原创 7-12 排序 (25 分)

题目链接这次 JAVA 又超内存了。还是用C++写过的;C++ code:#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;algorithm&gt;using namespace std;int num[100005];int main(){ ...

2018-11-01 23:06:14 592

原创 7-24 树种统计 (25 分)

题目连接哎,这个题我真是草了,我用java写了一个小时,没写出来,写出来了,答案对了,他妈的只过了两个点,剩下的两个点超内存,我真吗日了,日了,日了,然后用C写了一个,一会就写出来了,而且对了,我真吗日了。江湖路远,不见月黑风高,java加油,Java永不放弃,学的明白才能玩的明白;这两天得把java的容器学学,明白明白。 c++ code (A)#include &lt...

2018-10-30 22:29:25 659

原创 7-13 统计工龄 (20 分)

题目链接import java.io.BufferedInputStream;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStream;import java.io.OutputStreamWriter;...

2018-10-30 16:57:42 262

原创 7-19 求链式线性表的倒数第K项 (20 分)

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.OutputStream;import java.io.OutputStreamWriter;import java.io...

2018-10-30 16:30:23 1984

原创 7-16 一元多项式求导 (20 分)

这个题简单,就是输入输出。package DataStructure;import java.io.*;import java.util.*;public class Main { static StreamTokenizer in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)))...

2018-10-23 23:32:20 1264

原创 7-10 公路村村通 (30 分) Java版本

这就是一个最短路 ,排一下序然后并查集start和end就行了,要是用c++做估计我10分钟就能做完,但是这个学期学java,那就用java吧,感觉好难啊 -- , 静态 动态这一块,上下文这一块。。。。。import java.util.Arrays;import java.util.Comparator;import java.util.Scanner;public class ...

2018-10-22 21:31:33 635

原创 Java中参数传递

这是我今天晚上的一点思考,还挺有意思的。是参考 java核心技术Ⅰ 和https://blog.csdn.net/jiangnan2014/article/details/22944075所理解的。其实看核心卷就能看懂了,然后我有从网上搜了一下。java中的方法都是传值的(call by value),但是如果说只能传递值的话,为什么,有的变量就可以改变,而有的却不能改变呢。...

2018-10-18 00:08:30 96

原创 HDU 1716 排列2

这就是一个全排列,他妈的格式化输出太恶心人了,注意:每次数据输出后有一个空行,但是! 0 0 0 0前面的那个数据没有空行。因为要去重 用setcode:#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;vector&gt;#include &lt;set&gt;#include &lt;algorith...

2018-10-15 19:52:27 156 1

原创 HDU 2510 符号三角形

 这是一个深搜水题,但是很扎心,写完代码然后打表,连续打错了两次,我日了。就是深搜第一行,每个元素有两种选择'+' 或者'-'(代码里我改成了1和2)然后带了N层 返回就行了 。it‘s real like dream My heart will go on表#include &lt;iostream&gt;#include &lt;cstdio&gt;using nam...

2018-10-14 20:51:44 162

原创 HDU 1581

思路 : 这个题就是深搜,然后剪一下枝(就是优化一下)#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;cmath&gt;using namespace std;int T,ans;int book[15];int a[15];void dfs(int st...

2018-10-14 15:51:36 145

原创 7-8 哈利·波特的考试 (25 分)

题目链接弗洛伊德算法吧。核心代码就四行。#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;vector&gt;#include &lt;queue&gt;#define INF 0x3f3f3f3f;using namespace std;int N,M;...

2018-10-12 20:43:03 1561

原创 7-9 旅游规划 (25 分)

题目链接//这个题跟个板题差不多,跌死啦算法,暑假第一周学过,当时学的挺明白的,现在就都忘了,又重新看了看网课,不错,稍微看一点就行了,DIj用来计算两个点的最短路径,就是不断找最短的路,然后一次次的更新就行了。哎怎么都忘了 。。 这个题我弄了个结构体就来存路长和过路费,然后跟板子一样。还有今天大学的运动会结束了,应该是人生最后一次参加运动会了(尽管这次没有报项目),我觉得应该记录...

2018-10-12 20:37:35 475

原创 7-7 六度空间 (30 分)

题目链接这个题用光搜做,从网上看的,我一开始以为是深搜,写半天没写出来。最后从网上看要用广搜做,想了半天,还觉得应该用深搜,无奈的我回到我的床上,躺下吃了两粒花生米,仔细思考了一下,就想出来广搜怎么做了!沉下心来,坐在电脑面前没有躺在床上思考的更犀利。我记得以前也有一个模拟链表的题也是在床上临睡前想出来的。用deep[]来记录层数,这个题感觉不是太难(写完之后。)#include &...

2018-10-09 20:39:15 583

原创 7-6 列出连通集 (25 分)

题目链接这个题一开始没仔细看结果,就觉得是一个并查集,写出来之后只能过一个点,然后才仔细去看了看样例,结果发现其实阳历都过不去,也不知道最后一个点怎么过的 - - ;这个题就是按照他说的来,一个深搜一个广搜。#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;q...

2018-10-09 14:55:43 640

原创 7-5 堆中的路径 (25 分)

题目链接这个题是一个二叉堆,就是priority_queue的底层实现,我从哔哩哔哩上看了看视频,了解了一下。二叉堆就是一颗完全二叉树,有往下越来越大的,也有往下越来越小的,都可以,优先队列是越来越大的;这个题就是模拟建一颗二叉树,然后向上打印就行了,有一个地方就是根节点是啊a[0]把它设置成无限小,就行了。code:#include &lt;iostream&gt;#in...

2018-10-08 15:32:14 1086

原创 51node 1416 两点

这个题做的,哎, 我的思想有点固化,看到图就觉得是搜索,但这个题好像用并查集也可以做。我一开始觉得是广搜,感觉可以写就写了一下,结果越写越觉得不大对,然后输入样例果然不对,思路就错了,后来又改成深搜,就做出来了,但是我认为网上一定有广搜做出来的,就从网上搜,但是没有搜倒,但是看到了并查集做法,思考了一会并查集果然可以做,但是没有写。#include &lt;iostream&gt;#i...

2018-10-02 23:25:39 68

原创 java中 int与 Integer的区别

这是我个人的理解不一定对,只是写下来加深一下印象,觉得不对的大佬可以当作没看过或者是指出错误int double float这种是基本数据类型,可用加减乘除等运算,也可以当作是参数进行传递。而想Integer这种东西是一个封装类,就是一个类,需要 Integer  num = new Integer(1);这样来定义(类就是这样定义的),然后要用到一些数据结构的时候(需要以类作为封装对象)...

2018-09-27 22:32:58 64

原创 7-4 是否同一棵二叉搜索树 (25 分)

题目链接这个题我一开始用Java写的,感觉没什么毛病,能想到的样例都能过,但是提交到OJ上一个点都过不了,我真懵了,如果有大佬路过的话希望帮我改一下,然后我又用C++写了一个就过了。。。。。。折。思路:就是建一颗二叉搜索树,然后一个点一个点的对比,如果整棵树有一样的话那就是一样,如果有一点不一样就是不一样。这是C++代码:#include &lt;iostream&gt;#in...

2018-09-26 00:05:31 782 1

原创 数据结构:二叉搜索树

二叉搜索树我先了解 了解了一天,就是看原理,看网课 ,然后再写的代码,感觉挺难的,但是打完了感觉也不是这么难,就是删除情况有点多,有四种。用JAVA写了一个。下面的代码只有插入,查找,删除,前序后序中序遍历这几种操作。package com.company;public class Main { public node root; public node find(i...

2018-09-23 00:10:10 135

原创 7-2 一元多项式的乘法与加法运算 (20 分

题目链接这个题也没用什么数据结构和算法感觉。。#include &lt;cstdio&gt;#include &lt;iostream&gt;#include &lt;algorithm&gt;#include &lt;cstring&gt;using namespace std;int n,m,a,b;int equ1[1010],equ2[1010]; //下标是指数,...

2018-09-18 23:29:00 2484

原创 7-1 最大子列和问题 (20 分)

题目链接   这是一个简单DP,其实我感觉就是类似前缀和的一个东西。#include &lt;cstdio&gt;#include &lt;iostream&gt;#include &lt;algorithm&gt;#include &lt;cstring&gt;using namespace std;int w[100010],dp[100010];int main(){...

2018-09-18 21:55:17 320

原创 CodeForces - 569A Music

题目链接这就是一道数学题;歌曲总时间:T;已下载时间:S;每Q秒能下载Q-1秒的歌曲;所以1s损失(1-(q-1)/q)个时间;所以S=(1-(q-1)/q)*t  ==&gt; t=S*q;所以代码#include &lt;iostream&gt;#include &lt;cstdio&gt;using namespace std;int main(){...

2018-09-17 19:59:17 118

原创 PTA乙级1063 JAVA版本

这个题的测试点二是卡输入输出的,如果没有优化输入输出的话就会超时,因为刚开始学习JAVA,不知道怎么优化输入输出然后就一直超时,最后从网上查的,就这样做出来了。 Scanner 输入的话太慢了。感觉JAVA输入输出的优化就是一个模板。import java.io.*;import java.util.*;public class Main { static StreamTok...

2018-08-22 22:27:23 265

原创 POJ 3667 Hotel

The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, has named the Bul...

2018-08-08 17:01:25 133

原创 Largest prime factor

Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, ...

2018-07-29 13:11:20 307

原创 Magic Five

There is a long plate s containing n digits. Iahub wants to delete some digits (possibly none, but he is not allowed to delete all the digits) to form his "magic number" on the plate, a number that is...

2018-07-29 13:05:53 263

原创 C Looooops

A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and wh...

2018-07-29 12:56:41 193

原创 Delete from the Left

You are given two strings ss and tt. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by 11....

2018-07-29 12:45:03 153

原创 Funky Numbers

As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are those...

2018-07-29 12:43:11 291 1

原创 Tr A

A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 &lt;= n &lt;= 10)和k(2 &lt;= k &lt; 10^9)两个数据。接下来有n行,每行有n个数据,每个数据的范围是[0,9],表示方阵A的内容。 Output对应每组数据,输出Tr(A^k...

2018-07-29 12:26:51 173

原创 Finding Seats

A group of K friends is going to see a movie. However, they are too late to get good tickets, so they are looking for a good way to sit all nearby. Since they are all science students, they decided to...

2018-07-29 12:25:30 274 1

原创 Pie

My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of ...

2018-07-29 12:21:09 331

原创 A Simple Math Problem

Lele now is thinking about a simple function f(x). If x &lt; 10 f(x) = x. If x &gt;= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10); And ai(0&lt;=i&lt;=9) can only be 0 or 1 ...

2018-07-29 12:09:49 369

原创 Polycarp and Div 3

Polycarp likes numbers that are divisible by 3.He has a huge number ss. Polycarp wants to cut from it the maximum number of numbers that are divisible by 33. To do this, he makes an arbitrary number...

2018-07-29 12:04:55 146

原创 Party All the Time

In the Dark forest, there is a Fairy kingdom where all the spirits will go together and Celebrate the harvest every year. But there is one thing you may not know that they hate walking so much that th...

2018-07-26 16:42:43 132

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除