自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 简单散列查找(除留取余+开放地址)

#include<stdio.h>#include<stdlib.h>int H(int key){ return key % 4;}int HS(int ht[], int m, int k, int *p){ int i, j, flag = 0; /*flag=0表示散列表未满*/ j = H(k); /*计算散列地址*/ i = j; /*记载起始位置*/ while (ht[i] != 0 && f

2021-05-31 14:36:33 127

原创 BFS+DFS遍历邻接矩阵

#include <stdio.h>#include <stdlib.h>#define MaxSize 10int vis[MaxSize]={0};typedef char DataType;typedef struct{ int vtnum, egnum; DataType vt[MaxSize]; int eg[MaxSize][MaxSize];} MGraph;void CreatGraph(MGraph *G){ int i,j,k; p

2021-05-24 14:58:25 237

原创 C语言二叉链表

#include<stdio.h>#include<stdlib.h>#include<malloc.h>typedef char DataType; typedef struct BiNode{ DataType data; struct BiNode *lchild, *rchild;} BiNode;BiNode * CreatBiTree(BiNode *root){ char ch; scanf("%c",&

2021-05-17 14:37:04 545

原创 C语言链栈

#include<stdio.h>#include<stdlib.h>typedef int DataType;typedef struct node{ DataType data; struct node *next;} Node;void InitStack(Node *top){ top = (Node *)malloc(sizeof(Node)); top->next = NULL;}int Push(Node *top, DataT.

2021-05-16 21:28:31 183

原创 2021.3.4打卡

搬桌子The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its s

2021-03-05 00:29:56 191 1

原创 2021.3.2打卡

田忌赛马大约2300年前,齐国大将田忌喜欢和国王赛马,并且约定:每赢一场,对方就要付200元。假设已知田忌和国王的各自马匹的速度都不相同,请计算田忌最好的结果是什么。Input输入包含多组测试样例。每组样例的第一行是一个整数n(n <= 1000),表示田忌和国王各自参赛的马匹数量。接下来一行的n个整数表示田忌的马的速度,再接下来一行的n个整数表示国王的马的速度。n为0时,表示输入数据的结束。Output每组数据输出一行,表示田忌最多能够赢得的金额。Sample Input

2021-03-03 01:26:42 176

原创 2021.3.1打卡

排序已知每一位同学的解题数量和罚时,这次希望你能输出排名靠前的若干同学的名单。注:排名首先依据做题数量,若做题数量相同,则比较罚时,罚时少的排名靠前。Input第一行是数据组数C,代表有C组测试实例。每一组数据第一行两个整数N和M,N代表有N个人的成绩,M表示老师需要你输出前M名的名单。接下来N行,每一行依次给出名字Name,做出的题目数量num和罚时time1 ≤ C ≤ 102 < M ≤ N ≤ 1000Name的长度最大为101 ≤ num ≤ 1010 ≤ time

2021-03-02 00:40:04 457

原创 2021.2.6寒假打卡Day30

Girls and BoysProblem Descriptionthe second year of the university somebody started a study on the romantic relations between the students. The relation “romantically involved” is defined between one girl and one boy. For the study reasons it is necessar

2021-02-06 23:41:03 112

原创 2021.2.4寒假打卡Day28

SearchA strange liftProblem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if you press the

2021-02-05 02:51:25 121

原创 2021.1.31寒假打卡Day24

CCUT20210131 大一E#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--){ int x,y,z,ans; cin>>x>>y>>z; ans=(z-y)/x*x+y; cout<<ans<<endl; }

2021-01-31 23:44:52 101

原创 2021.1.28寒假打卡Day21

求n个数的最小公倍数#include<iostream>using namespace std;int gcd(int a,int b){ int r=a%b; if(r==0) return b; else return gcd(b,r);}int nlcm(int a[],int b){ while(b!=1){ a[b-2]=a[b-1]*a[b-2]/gcd(a[b-1],a[b-2]); --b; }

2021-01-30 00:54:39 137

原创 2021.1.27寒假打卡Day20

哈尔滨学院2021ACM冬令营–字符串专题A TEX Quotes#include<iostream>#include<string>using namespace std;int main(){ string s; int cnt=0; while(cin>>s){ int len=s.length(); for(int i=0;i<len;i++){ if(s[i]=='"'){ ++cnt; if(cnt%2==

2021-01-28 03:50:14 199

原创 2021.1.26寒假打卡Day19

Luogu P1182给 n 个数,分成连续的 m 段,求分段后每段和的最大值的最小值。标准二分法#include<iostream>using namespace std;const int maxn=1e5+10;int n,m,a[maxn];bool check(int x){ int sum=0,cnt=0; for(int i=0;i<n;i++) if(sum+a[i]<=x) sum+=a[i]; else sum=a[i],++cn

2021-01-27 00:04:37 96

原创 2021.1.25寒假打卡Day18

CF #673(Div.3)A - Odd Divisor一直除以 2 ,如果最后不是 1 ,就含有Odd Divisor顺便吐槽一下这奇妙的机翻,真就直译(原文:Check if n has an odd divisor, )#include<iostream>using namespace std; bool have(unsigned long long int n){ if(n==1) return false; else if(n % 2 == 0) retu

2021-01-26 01:57:27 144

原创 2021.1.20寒假打卡Day16

A - Wizard of OrzThere are n digital panels placed in a straight line. Each panel can show any digit from 0 to 9. Initially, all panels show 0.Every second, the digit shown by each panel increases by 1. In other words, at the end of every second, a panel

2021-01-22 05:32:58 365 1

原创 2021.1.21寒假打卡Day17

丑数Problem Description丑数的定义是这样的——一个数,如果它分解后的素因子最多只有2、3、5、7四种,这个数则称为“丑数”。比如,前20个丑数是:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27。现在你的任务是:给你一个数,你能判断是否是丑数吗?Input输入数据的第一行首先是一个整数C,表示测试数据的个数,然后是C组数据,每组测试数据包含一个整数n(1 <= n <= 2^3

2021-01-22 02:52:23 284

原创 2021.1.19寒假打卡Day15

P1241 括号序列定义如下规则序列(字符串):空序列是规则序列;如果S是规则序列,那么(S)和[S]也是规则序列;如果A和B都是规则序列,那么AB也是规则序列。例如,下面的字符串都是规则序列:(),[],(()),([]),()[],()[()]而以下几个则不是:(,[,],)(,()),([()jh15024551551@96371现在,给你一些由(,),[,]构成的序列,你要做的,是补全该括号序列,即扫描一遍原序列,对每一个右括号,找到在它左边最靠近它的左括号匹配,如

2021-01-20 05:10:11 180

原创 2021.1.18寒假打卡Day14

洛谷题单 动态规划1P1434 [SHOI2002]滑雪Michael 喜欢滑雪。这并不奇怪,因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael 想知道在一个区域中最长的滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子:1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12

2021-01-20 00:49:14 146

原创 2021.1.17寒假打卡Day13

A - 小心FST!Mia Hossain is a very good competitive programmer & spends his most of the time in programming contest. His wife is very much interested in competitive programming. In her free time she sits beside him & curiously watches how he solves p

2021-01-18 03:29:28 436

原创 2021.1.15寒假打卡Day12

第十二届蓝桥杯大赛模拟赛(第二期)填空题小明要用二进制来表示 1 到 10000 的所有整数,要求不同的整数用不同的二进制数表示,请问,为了表示 1 到 10000 的所有整数,至少需要多少个二进制位?14Win10计算器是个好东西????请问在 1 到 2020 中,有多少个数既是 4 的整数倍,又是 6 的整数倍。168穷举呀穷举一个无向图包含 2020 条边,如果图中没有自环和重边,请问最少包含多少个结点?65这个我不会做,编了一个2019????后来百度了

2021-01-15 17:29:13 248

原创 2021.1.14寒假打卡Day11

C - 1-SATProblem StatementGiven are N strings S1,S2,…,SN. Each of these is a non-empty string consisting of lowercase English letters, with zero or one ! added at the beginning.We say a string T to be unsatisfied when it matches one of S1,S2,…,SN regard

2021-01-15 03:27:16 250

原创 2021.1.13寒假打卡Day10

今天在水牛客题的时候,碰到了这么一道题:原谅下饭如我,当时我就懵了。。。那么啥叫移位运算呢?我默默打开了才知道移位运算符有两个<<和>>,属于双目运算符。<<:左移 左边高位舍弃,右边低位补零。若高位没有丢失信息,则<<n效果等同于* pow(2,n)。41883 如下101000111001101141883 << 1 如下010001110011

2021-01-14 02:57:08 174

原创 2021.1.12寒假打卡Day9

P3613 【深基15.例2】寄包柜题目描述超市里有 n (n ≤ 105) 个寄包柜。每个寄包柜格子数量不一,第 i 个寄包柜有 ai (ai ≤ 105) 个格子,不过我们并不知道各个 ai 的值。对于每个寄包柜,格子编号从 1 开始,一直到 ai 。现在有 q (q ≤ 105) 次操作:1 i j k:在第 i 个柜子的第 j 个格子存入物品 k (0 ≤ k ≤ 109)。当 k=0k=0 时说明清空该格子。2 i j:查询第 i 个柜子的第 j 个格子中的物品是什么,保证查询的柜子

2021-01-13 04:35:38 203

原创 2021.1.11寒假打卡Day8

哈尔滨学院2021ACM冬令营Day2(20级)The puzzleProblem DescriptionKayaking is playing a puzzle game containing n different blocks. He marks the blocks with integers from 1 to n, which show the blocks’ original positions. Each time he can exchange two blocks and he w

2021-01-12 03:01:13 187

原创 2021.1.10寒假打卡Day7

哈尔滨学院2021ACM冬令营训练赛(一)A. Short SubstringsAlice guesses the strings that Bob made for her.At first, Bob came up with the secret string a consisting of lowercase English letters. The string a has a length of 2 or more characters. Then, from string a he bui

2021-01-11 03:13:49 324

原创 2021.1.9寒假打卡Day6

哈尔滨学院2021ACM冬令营Day1E - ACboy needs your help again!ACboy was kidnapped!!he miss his mother very much and is very scare now.You can’t image how dark the room he was put into is, so poor ???? .As a smart ACMer, you want to get ACboy out of the monster’s

2021-01-10 02:25:18 229

原创 2021.1.8寒假打卡Day5

寒假打卡 Day 5数据结构队列????规则:先进先出(和我们食堂里排队一样,先来的人先轮到打饭 食堂好像不用排队 )操作:enqueue(x); //在队列末尾添加元素xdequeue(); //从队列开头取出元素isEmpty(); //检查队列是否为空isFull(); //检查队列是否已满Queue????There are n processes in a queue. Each process has namei and timei. The round-ro

2021-01-09 01:06:04 279

原创 2021.1.7寒假打卡Day4

寒假打卡 Day 4直入主题,瞧瞧昨天的遗留问题:Shell Sort????Shell Sort is a generalization of Insertion Sort to arrange a list of n elements A. insertionSort(A, n, g) for i = g to n-1 v = A[i] j = i - g while j >= 0 && A[j] &

2021-01-07 22:50:48 173

原创 2021.1.6寒假打卡Day3

寒假打卡Day3今天开始看的是 这本书???? d6tc我就截取看到的重点做了些笔记 (绝对不是因为懒(/ω\))算法的效率复杂度分为两方面:Time ComplexitySpace Complexity在竞赛中,题目限制通常为 1s ,即大约108 次操作,因此我们通常遇到的都是时间复杂度过高的问题。表示法:Big-Oh-Notation诸如O(n),O(n2)···O(g(n)),g(n)可以认为是1s内的操作次数e.g. 给出m个数ai (i=1,2,···,m),找出最

2021-01-06 23:22:51 218

原创 2021.1.5寒假打卡Day2

寒假打卡Day2(今天是今天写的(/ω\)) 今天看的是递归哦求两个数的最大公因数这题因为太简单所以没有oj有,那就没有链接啦(bushi#include <iostream>using namespace std;int gcd(int a,int b){ if(a%b==0) return b; else return gcd(b,a%b); }int main(){ int a,b; cin>>a>>b; cout<<gc

2021-01-05 23:49:35 141

原创 2021.1.4寒假打卡Day1

寒假打卡Day1(说是说Day1,其实是Day2补写的(/ω\))总之今天很水,划了一天的水。。。problem 1: Way Too Long WordsSometimes some words like “localization” or “internationalization” are so long that writing them many times in one text is quite tiresome.Let’s consider a word too long, if

2021-01-05 22:35:17 277

空空如也

空空如也

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

TA关注的人

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