自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 hdu5685

#include<bits/stdc++.h>using namespace std;int MOD=9973;string s;int sum[100050];int quick_pow_mod(int a,int n){ int ans=1; int base=a; while(n!=0){ if(n%2){ ans=(ans*base)%MOD; } base=(base*base).

2021-07-12 15:17:26 121

原创 hdu1421

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-26 21:03:23 108

原创 hdu1087

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-26 20:19:47 102

原创 hdu1257

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-26 20:15:27 94

原创 hdu1160

#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;int b[1001];int a[1001];int c[1001];struct node{ int w; int v; int sign;} s[1001];int cmp(node x, node y){ if(x.w==y.w) return .

2021-05-26 20:02:10 64

原创 hdu1176

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-26 19:43:10 65

原创 hdu2084

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-20 20:40:26 80

原创 hdu1058

#include<bits/stdc++.h>#define LL long long#define GG long long#define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar(); .

2021-05-20 20:11:14 67

原创 pta7-4 最短路径算法(Floyd-Warshall) (20 分)

在带权有向图G中,求G中的任意一对顶点间的最短路径问题,也是十分常见的一种问题。解决这个问题的一个方法是执行n次迪杰斯特拉算法,这样就可以求出每一对顶点间的最短路径,执行的时间复杂度为O(n​3​​)。 而另一种算法是由弗洛伊德提出的,时间复杂度同样是O(n​3​​),但算法的形式简单很多。在本题中,读入一个有向图的带权邻接矩阵(即数组表示),建立有向图并使用Floyd算法求出每一对顶点间的最短路径长度。输入格式:输入的第一行包含1个正整数n,表示图中共有n个顶点。其中n不超过50。以.

2021-05-19 19:15:10 2108

原创 pta2050

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 20:30:04 85

原创 洛谷P1044

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 19:10:44 100

原创 hdu2067

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 19:08:06 64

原创 hdu2045

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 18:51:53 58

原创 hdu2047

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 15:31:29 98

原创 hdu2044

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 15:12:07 65

原创 hdu2041

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 15:09:15 71

原创 hdu2501

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 14:55:19 106

原创 hdu2190

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 14:40:52 74

原创 hdu2046

#include<bits/stdc++.h>#include<iostream> #define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-05-16 14:21:26 51

原创 hdu1272

#include<iostream>using namespace std;#define MAX 100005int father[MAX],flag,sign[MAX];int FindSet(int x){ while(x!=father[x]) x=father[x]; return x; } void Union(int x,int y) { x=FindSet(x); y=FindSet(y); .

2021-05-13 19:33:28 54

原创 hdu1879

#include<iostream>#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k;.

2021-05-12 20:25:27 62

原创 hdu1863

#include<iostream>#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k;.

2021-05-12 20:11:36 37

原创 pta1233还是畅通工程

#include<iostream>#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k;.

2021-05-12 20:07:45 63

原创 pta KMP算法

函数get_nextval(char T[], int nextval[])是计算字符串T的next数组,函数Index_KMP(char S[], char T[], int pos, int next[])是KMP算法。函数接口定义:void get_nextval(char T[], int next[]);int Index_KMP(char S[], char T[], int pos, int next[]);其中T是模式串,S是主串,next是next数组。裁判...

2021-04-27 19:39:05 2438 1

原创 天梯赛训练3 L1-5 胎压监测

让我们把四个车轮 —— 左前轮、右前轮、右后轮、左后轮 —— 顺次编号为 1、2、3、4。本题就请你编写一个监测程序,随时监测四轮的胎压,并给出正确的报警信息。报警规则如下:如果所有轮胎的压力值与它们中的最大值误差在一个给定阈值内,并且都不低于系统设定的最低报警胎压,则说明情况正常,不报警; 如果存在一个轮胎的压力值与它们中的最大值误差超过了阈值,或者低于系统设定的最低报警胎压,则不仅要报警,而且要给出可能漏气的轮胎的准确位置; 如果存在两个或两个以上轮胎的压力值与它们中的最大值误差超过了阈值,或.

2021-04-22 20:45:07 215

原创 天梯赛训练3 L2-3 完全二叉树的层序遍历

一个二叉树,如果每一个层的结点数都达到最大值,则这个二叉树就是完美二叉树。对于深度为D的,有N个结点的二叉树,若其结点对应于相同深度完美二叉树的层序遍历的前N个结点,这样的树就是完全二叉树。给定一棵完全二叉树的后序遍历,请你给出这棵树的层序遍历结果。输入格式:输入在第一行中给出正整数N(≤30),即树中结点个数。第二行给出后序遍历序列,为N个不超过 100 的正整数。同一行中所有数字都以空格分隔。输出格式:在一行中输出该树的层序遍历序列。所有数字都以 1 个空格分隔,...

2021-04-22 20:38:32 96

原创 PTA 7-4出栈序列的合法性

https://pintia.cn/problem-sets/1373899177892786176/problems/1373902577301671937给定一个最大容量为M的堆栈,将N个数字按 1, 2, 3, ...,N的顺序入栈,允许按任何顺序出栈,则哪些数字序列是不可能得到的?例如给定M=5、N=7,则我们有可能得到{ 1, 2, 3, 4, 5, 6, 7 },但不可能得到{ 3, 2, 1, 7, 5, 6, 4 }。输入格式:输入第一行给出 3 个不超过 100...

2021-04-14 20:36:10 361

原创 PTA 7-26 Windows消息队列

https://pintia.cn/problem-sets/15/problems/841#include<bits/stdc++.h>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;const int N = 1011; co

2021-04-14 20:19:52 149

原创 HDU1872

#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct node{ int index; char name[55]; int grade;}num[400],tmp[400];int pos[400];bool cmp(node a,node b){ if(a.grade.

2021-04-14 18:23:50 77

原创 HDU1232

#include<iostream>#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k;.

2021-04-11 18:37:48 46

原创 HDU-2093

#include<iostream>#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k;.

2021-04-11 13:39:41 79

原创 HDU3183

#include<iostream>#include<cstdio>#include<cstring>#include<stack>using namespace std;const int maxn = 1010;stack<int> sta;int main(){ int ans[maxn]; string str; int k;int i; while(cin>>str>&gt.

2021-04-07 20:58:32 69

原创 HDU-2454

#include<bits/stdc++.h>using namespace std;#define MAX_N 1009int ds[MAX_N];int main(){ int t, n, p, flg; scanf("%d", &t); while(t--){ scanf("%d", &n); for(int i = 1; i <= n; i++) scanf("%d", ds+i); .

2021-04-07 20:36:36 61

原创 HDU 1236

#include <stdio.h> #include <math.h>#include <string.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std.

2021-04-06 19:01:16 39

原创 HDU-2037

#include <stdio.h> #include <math.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;const int N = 1011; dou.

2021-04-03 14:06:43 84

原创 1050

#include <stdio.h> #include <math.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;const int N = 1011; int.

2021-04-03 10:00:23 54

原创 HDU-1052

#include <stdio.h>#include <stdlib.h>#define max( a, b ) a > b ? a : bconst int maxn = 1005;int tj[maxn],king[maxn];int cmp ( const void *p1, const void *p2 ) { return *( int * )p1-*( int * )p2;}void print ( int a[], int n ) { .

2021-04-03 09:32:22 119

原创 HDU-1009

#include <stdio.h> #include <math.h>#include <algorithm>#define LL long long#define GG int #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;const int N = 1011; str.

2021-04-02 19:52:19 74

原创 pta 数据结构6-1

6-1 单链表逆转List Reverse(List L) { PtrToNode Old_head,New_head,Temp; Old_head=L; New_head=NULL; while(Old_head) { Temp=Old_head->Next; Old_head->Next=New_head; New_head=Old_head; Old_head=Temp; }

2021-03-31 19:10:54 192

原创 洛谷4779 Dijkstra+堆优化

#include<bits/stdc++.h>#define LL long long#define GG long long #define For(i, j, k) for(int i=j; i<=k; i++)#define Dow(i, j, k) for(int i=j; i>=k; i--)using namespace std;inline GG read() { GG x = 0, f = 1; char ch = getchar();.

2021-03-30 19:57:09 135

空空如也

空空如也

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

TA关注的人

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