自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 1003 我要通过! (20分)

答案错误”。得到“答案正确”的条件是:字符串中必须仅有P、A、T这三种字符,不可以包含其它字符; 任意形如xPATx的字符串都可以获得“答案正确”,其中x或者是空字符串,或者是仅由字母A组成的字符串; 如果aPbTc是正确的,那么aPbATca也是正确的,其中a、b、c均或者是空字符串,或者是仅由字母A组成的字符串。现在就请你为 PAT 写一个自...

2020-03-19 21:17:01 178

原创 1009 说反话 (20分)

给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:import java.ut...

2020-03-19 21:15:35 170

原创 pta 1008 数组元素循环右移问题 (20分)

一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A​0​​A​1​​⋯A​N−1​​)变换为(A​N−M​​⋯A​N−1​​A​0​​A​1​​⋯A​N−M−1​​)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?输入格式:每个输入包含一个测试用例,第1行输入N...

2020-03-19 21:10:25 366

转载 计算几何(练习)

一。点,线,面,形基本关系,点积叉积的理解POJ 2318 TOYS(推荐)http://acm.pku.edu.cn/JudgeOnline/problem?id=2318POJ 2398 Toy Storage(推荐)http://acm.pku.edu.cn/JudgeOnline/problem?id=2398一个矩形,有被若干直线分成N个格子,给出一个点的坐标,问你该点位...

2019-05-16 17:19:38 548

原创 多边形面积 以及统计在边上的点和多边形内部的点(1265)Pick 定理

area=I+E/2-1(I为内部格数,E为边上的点数) 边上格点数 = gcd(abs(x),abs(y))-1;#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#define N 1003usin...

2019-05-16 17:09:06 860

原创 多边形面积(1654)

#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;struct Point{ int x,y; Point(){} Point(int x,int y):x(x),y(y){}};typ...

2019-05-16 16:45:08 166

原创 模拟退火(最小球覆盖,最小圆覆盖)

#include <iostream>#include <string.h>#include <stdio.h>#include <math.h> #define N 150#define eps 1e-8#define T 100#define delta 0.98#define INF 1e99 using namespa...

2019-05-16 16:01:34 695

原创 poj1066(计算几何线段相交)

#include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#include <cstdlib>#include <iomanip>using namespace std;con...

2019-05-14 23:50:03 142

原创 poj2653(计算几何)

http://poj.org/problem?id=2653#include<iostream>#include<cstdio>#define eps 1e-8const int maxn = 1e5+10;using namespace std;struct Point{ double x; double y;}pt1[maxn],pt2[maxn...

2019-05-14 23:19:46 190

原创 poj1556(计算几何+最短路)

#include<iostream>#include<cstdio>#include<math.h>#include<algorithm>#define inf 0x3f3f3fconst int maxn = 1e3+10;const double eps = 1e-8;using namespace std;struct Poi...

2019-05-14 21:52:41 173

原创 poj1269

nt judgecross(){ if(min(p[0].x,p[1].x)>max(p[2].x,p[3].x)||min(p[0].y,p[1].y)>max(p[2].y,p[3].y)||max(p[0].x,p[1].x)<min(p[2].x,p[3].x)||max(p[0].y,p[1].y)<min(p[2].y,p[3].y)){ return ...

2019-05-13 16:37:37 218

原创 poj 3304(计算几何叉积)

http://poj.org/problem?id=3304判断所有线段段点是否能出现一个直线经过所有线段#include<iostream> #include<math.h>#include<cstdio>const double eps = 1e-8;const int maxn = 1005;using namespace std;...

2019-05-13 14:32:09 167 2

原创 2017江西icpc邀请赛 快速幂板子

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int MD=1000000007;int p[5]= {0,1,5,11,36};struct Matrix { ll a[4][4]; Matrix() { memset(a,0,sizeof(a)); } Matrix...

2019-05-04 12:57:26 117

原创 hdu dp1176 1203 2159 2577

http://acm.hdu.edu.cn/showproblem.php?pid=1176  跟那个塔一样    dp[i][j]=max(dp[i+1][j-1],dp[i+1][j],dp[i+1][j+1]) i时间 j是 位置#include&lt;iostream&gt;#include&lt;string.h&gt;using namespace std;int a[10...

2019-01-20 14:28:30 158

原创 牛客国庆集训派对Day1(最短路作图)优先队列

https://ac.nowcoder.com/acm/contest/201/L#include&lt;bits/stdc++.h&gt;#include&lt;iostream&gt;#include&lt;algorithm&gt;#define maxn 1200#define inf 9999999using namespace std;typedef pair&lt;...

2019-01-19 17:55:49 214

原创 HDU (dp) 2955 1864 1231 1506 1505 2602 1087 2571 1069

http://acm.hdu.edu.cn/showproblem.php?pid=2955  dp[j]=max(dp[i],dp[j-ac[i].M]*(1-ac[i].P));#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;string.h&gt;#include&lt;math.h&gt;using...

2019-01-18 16:38:42 126

原创 HDU(组合数 母函数)1028、1398、1085丶2069

1.  题目:http://acm.hdu.edu.cn/showproblem.php?pid=1028  //求和等于n的不同组合数的方法有多少种#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;string.h&gt;#include&lt;stdio.h&gt;#define mod 10000#def...

2019-01-17 16:05:42 150

转载 AOE

认识AOE网  有向图中,用顶点表示活动,用有向边表示活动之间开始的先后顺序,则称这种有向图为AOV(Activity On Vertex)网络;AOV网络可以反应任务完成的先后顺序(拓扑排序)。  在AOV网的边上加上权值表示完成该活动所需的时间,则称这样的AOV网为AOE(Activity On Edge)网,如下图:       图中,顶点表示事件(能被触发,两特征属...

2019-01-03 18:46:33 1152

原创 hdu 2544最短路(dijkstra+链式前向星)

http://acm.hdu.edu.cn/showproblem.php?pid=2544 Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?   Input输入包括多组...

2018-12-23 18:03:44 297

原创 hdu2647(链式前向星+拓扑排序)Reward

http://acm.hdu.edu.cn/showproblem.php?pid=2647Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about h...

2018-12-23 17:20:28 278

转载 Invitation Cards poj 1511

Invitation CardsTime Limit: 8000MS   Memory Limit: 262144K Total Submissions: 34113   Accepted: 11314 DescriptionIn the age of television, not many people attend theater performanc...

2018-12-17 18:54:37 101

原创 Til the Cows Come Home(dijkstra()堆优化)

#include&lt;iostream&gt;#include&lt;queue&gt;#include&lt;vector&gt;#define maxn 1005#define inf 0x3f3f3f3fusing namespace std;struct edge { int to;//下一个点 int w;//权值};vector&lt;edge&gt;G[max...

2018-12-17 17:48:37 280 3

原创 B. Labyrinth(BFS 记忆化搜索)

time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are playing some computer game. One of its levels puts you in a maze consistin...

2018-12-17 13:48:18 301

原创 B. Kvass and the Fair Nut

https://codeforces.com/contest/1084/problem/B题意为他有n个杯子,然后你需要倒出来l升水,现在需要求能杯子里边倒出那么多水之后,剩下的杯子里边的水的的最小值。先判断这些水能不能充满水桶。如果能的话,可以先求出最少的杯子里边的值然后判断,每杯水与最小值的水之间的差值能否使桶充满。#include&lt;iostream&gt;#includ...

2018-12-17 11:25:04 207

原创 临界表和邻接矩阵DFS,BFS,Dijkstra

#include&lt;iostream&gt;#include&lt;string.h&gt;#include&lt;stdio.h&gt;#include&lt;stdlib.h&gt;#define MaxInt 32767#define MVNum 100#define MAX_VERTEX_NUM 20#define clear(a,b) memset(a,b,size...

2018-12-13 12:55:25 440

原创 队列

/*#include&lt;iostream&gt;#define Status inttypedef int QElemType;using namespace std;typedef struct QNode{ QElemType data; struct QNode *next;}QNode, *QueuePtr;typedef struct {...

2018-12-13 12:54:20 86

原创 线性表

#include &lt;iostream&gt;#include &lt;cstdlib&gt;using namespace std;//1.定义存储表示 ppt 22页typedef int ElemType; //定义ElemType类型为int# define LIST_INIT_SIZE 100 // 线性表存储空间的初始分配量# d...

2018-12-13 12:53:57 119

原创

#include&lt;iostream&gt;#include&lt;malloc.h&gt;#define SElemType int#define STACK_INIT_SIZE 100#define STACKINCREMENT 10typedef int Status;using namespace std;typedef struct{ SElemType *...

2018-12-13 12:53:15 71

原创 哈弗曼树

#include"stdio.h"#include"string.h"#include"malloc.h"#include"iostream"using namespace std;typedef struct{ unsigned int weight; unsigned int parent,lchild,rchild;}HTNode,*HuffTree;type...

2018-12-13 12:52:30 124

原创 二叉树(数据结构)

#include &lt;iostream&gt;#include &lt;malloc.h&gt;#define TElemType char#define SElemType char#define STACK_INIT_SIZE 100#define STACKINCREMENT 10#define MAXQSIZE 100typedef char QElemType;t...

2018-12-13 12:50:59 186

原创 Codeforces Round #525 (Div. 2)

C. Ehab and a 2-operation tasktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an array aa of length nn. You can perf...

2018-12-10 13:36:39 75

原创 B. Vasya and Books codeforce 1073B

B. Vasya and Bookstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has got nn books, numbered from 11 to nn, arranged in a s...

2018-12-07 17:40:15 130

原创 合根植物 蓝桥杯(并查集)

http://lx.lanqiao.cn/problem.page?gpid=T458#include&lt;iostream&gt;#define maxn 1000010using namespace std;int pre[maxn];int n,m,k,cnt;int find(int x){ int temp=x; while(temp!=pre[temp]){ ...

2018-12-03 12:59:28 676

原创 HDU 6446 Tree and Permutation(根节点)

这道题我记得当时是在网上找的板子。。。。http://acm.hdu.edu.cn/showproblem.php?pid=6446先定义一个数n,n个数有n!种排列方法,然后求两条边的权值之和,显然他是有(n-1)!2种结果,对于两个相邻的点来说,他的计算的次数其实是两个边的节点所形成的树的子树的数量。#include&lt;iostream&gt;#include&lt;std...

2018-11-29 22:03:55 100

原创 HDU 1176 免费馅饼

http://acm.hdu.edu.cn/showproblem.php?pid=1176 Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接...

2018-11-29 13:37:35 54

原创 二叉树

#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;#define LEN sizeof(struct student)typedef struct student *stud;struct student{ int score; stud left; stud right;};static stud* q;static i...

2018-11-27 21:58:10 69

原创 A. Alyona and Numbers(CF ROUND 358 DIV2)

暴力会超时。。。#include&lt;iostream&gt;using namespace std;int main(){ long long n,m,sum=0; cin&gt;&gt;n&gt;&gt;m; for(int i=1;i&lt;=n;i++){ sum+=(i+m)/5-i/5; } cout&lt;&lt;sum&lt;&lt;endl; retu...

2018-11-27 13:20:32 113

原创 最近公共祖先·三 (LCA在线算法)

描述上上回说到,小Hi和小Ho使用了Tarjan算法来优化了他们的“最近公共祖先”网站,但是很快这样一个离线算法就出现了问题:如果只有一个人提出了询问,那么小Hi和小Ho很难决定到底是针对这个询问就直接进行计算还是等待一定数量的询问一起计算。毕竟无论是一个询问还是很多个询问,使用离线算法都是只需要做一次深度优先搜索就可以了的。那么问题就来了,如果每次计算都只针对一个询问进行的话,那么这样的...

2018-09-06 17:18:31 185

原创 HDU 1160 FatMouse's Speed(dp)

Total Submission(s): 20872 Accepted Submission(s): 9269Special Judge   Problem Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to tak...

2018-08-31 09:59:01 88

原创 小叶的巡查(树的最大边)

链接:https://www.nowcoder.com/acm/contest/181/D来源:牛客网 题目描述8102年,牛客系列竞赛空前繁荣。为了更好地管理竞赛,小叶决定巡查于各大城市之间,体察民情。所以,从一个城市马不停蹄地到另一个城市成了小叶最常做的事情。小叶有一个钱袋,用于存放往来城市间的路费。这个国家有一套优秀的交通方案,使得任何一个大城市都能从首都直接或者通过其他大城...

2018-08-30 15:38:57 291

空空如也

空空如也

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

TA关注的人

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