- 博客(80)
- 收藏
- 关注
原创 kuangbin带你飞 专题1-23 题单
kuangbin大神,对于打过ACM比赛的ACMer,无人不知无人不晓。 在此,附上vjudge平台上一位大神整理的[kuangbin带你飞]专题目录链接。[kuangbin带你飞专题目录1-23] : https://vjudge.net/article/187专题一 简单搜索POJ 1321 棋盘问题POJ 2251 Dungeon MasterPOJ 3278 Catch That...
2020-01-27 10:07:07 2744
原创 蓝桥杯第七届决赛真题JAVA大学C组
蓝桥杯第七届决赛真题JAVA大学C组#include <iostream>#include <cstdio>using namespace std;bool vis[1005];int main() { int ans = 0; for (int i = 0; i <= 1000; i ++) { if (!vis[(i * i) % 100]) ans ++; vis[(i * i) % 100] = true; } cout <<
2021-05-26 17:26:14 191
原创 蓝桥杯2016年第七届C++B组
蓝桥杯2016年第七届C++B组#include <iostream>#include <algorithm>using namespace std;int main() { int ans = 600; for (int i = 0; i <= 300; i ++) { for (int j = 0; j <= 300; j ++) { if (i * 97 - j * 127 == 1) { ans = min(ans, i +
2021-05-24 18:48:09 357 5
原创 第十届蓝桥杯大赛软件类决赛Java大学B组
第十届蓝桥杯大赛软件类决赛Java大学B组#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>using namespace std;int n = 30, m = 50;char mp[55][55];int cnt = 0;//string str = "LANNQIAO";string
2021-04-30 16:49:09 359 2
原创 ACM训练赛第19场补题
ACM训练赛第19场补题问题 A: At Least Average时间限制: 1 Sec 内存限制: 128 MB题目描述Blake plays a video game that has n levels. On each level, she can earn in between 0 and 10 points, inclusive. The number of points she gets on a level must be an integer. She has set up a
2021-04-22 20:30:15 244
原创 ACM训练赛第17场
ACM训练赛第17场问题 A: Bing Bong to Bong Bong时间限制: 2 Sec 内存限制: 128 MB题目描述Bing Bong, the pink imaginary friend from Riley’s childhood, is lonely.He wants to preserve his memory, but he wants to try to hide his name in the stories. He wants you to help him do
2021-04-14 16:32:47 430
原创 ACM训练赛第16场
ACM训练赛第16场问题 F: Exam Manipulation时间限制: 1 Sec 内存限制: 128 MB题目描述A group of students is taking a True/False exam. Each question is worth one point. You, as their teacher, want to make your students look as good as possible—so you cheat! (I know, you would
2021-04-12 17:36:58 551
原创 Linux环境下输出Hello World
Linux环境下输出Hello World进入home目录cd /home创建C++目录mkdir C++进入C++目录下cd C++创建C语言文件touch HelloWorld.c编辑C语言文件vim HelloWorld.c进入后按键盘上的i进入insert模式敲入C语言代码按住Esc键退出写入模式保存退出命令:wq生成可执行文件gcc HelloWorld.c -o HelloWorld运行HelloWorld文件./HelloWorld
2021-04-02 17:05:05 1940
原创 贪心
贪心import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n + 5]; for (int i = 0; i < n; i ++) { a[i] = in.nextInt(); } int
2021-04-01 20:44:13 134
原创 双指针与BFS
双指针与BFSimport java.util.ArrayList;import java.util.Collections;import java.util.Scanner;import java.util.Comparator;public class Main { static int[] cnt = new int[100000 + 5]; static boolean[] st = new boolean[100000 + 5]; public static void
2021-03-31 19:25:28 219 2
原创 枚举、模拟与排序
枚举、模拟与排序import java.util.Scanner;public class Main { static int INF = 0x3f3f3f3f; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n + 5]; for (int i = 0; i < n; i ++
2021-03-26 22:19:03 169
原创 数学与简单DP
数学与简单DPimport java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); System.out.println(n * m - n - m); }}import java.util.Scanner
2021-03-24 20:56:58 180
原创 二分与前缀和
二分与前缀和import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int q = in.nextInt(); int[] a = new int[n + 5]; for (int i = 0; i < n; i ++) { a[i
2021-03-23 19:25:03 200
原创 递归与递推
递归与递推import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < 1 << n; i ++) { for (int j = 0; j < n; j ++) { if ((i
2021-03-22 16:40:02 222 1
原创 蓝桥杯 九宫重排
蓝桥杯 九宫重排C++#include <iostream>#include <cstdio>#include <string> #include <cstring>#include <algorithm>#include <queue>using namespace std;int dx[] = {1, -1, 0, 0};int dy[] = {0, 0, 1, -1};int factor[] = {
2020-11-07 17:14:58 225
原创 区间dp模板 石子合并
石子合并设有N堆石子排成一排,其编号为1,2,3,…,N。每堆石子有一定的质量,可以用一个整数来描述,现在要将这N堆石子合并成为一堆。每次只能合并相邻的两堆,合并的代价为这两堆石子的质量之和,合并后与这两堆石子相邻的石子将和新堆相邻,合并时由于选择的顺序不同,合并的总代价也不相同。例如有4堆石子分别为 1 3 5 2, 我们可以先合并1、2堆,代价为4,得到4 5 2, 又合并 1,2堆,代价为9,得到9 2 ,再合并得到11,总代价为4+9+11=24;如果第二步是先合并2,3堆,则代价为7,得
2020-11-01 15:22:26 365
原创 01背包优先队列优化
01背包优先队列优化设重量为w,权值为v则单位重量价值为v / w设有物品1,物品2若v1 / w1 < v2 / w2则说明v2的单位重量价值高即v1 * w2 < v2 * w1于是可重载结构体,使得v2 * w1大的优先级高即:struct Node { LL w, v; Node() {}; Node(LL _w, LL _v) {w = _w, v = _v;} friend bool operator < (Node a, Node b) {
2020-10-31 19:17:11 556
原创 Java函数判定大素数
Java函数判定大素数import java.math.BigInteger;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); BigInteger x; while(in.hasNextBigInteger()) { x = in.nextBigInteger(); if(x
2020-10-28 17:30:05 312
原创 SPFA最短路Java模板
SPFA最短路Java模板import java.util.LinkedList;import java.util.Queue;public class Main { public static void main(String[] args) { } static int MAXN = 10000 + 10; static int[] head = new int[MAXN]; static int[] nxt = new int[MAXN << 1]; st
2020-10-15 19:01:06 259 2
原创 ST表
ST表模板ST表求区间最大值模板import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); while(T -- > 0) { int n = in.nextInt(); num = new int[100000 + 10][20]
2020-10-13 10:27:02 286
原创 二进制枚举
二进制枚举ACM中二进制枚举C++1秒大约能枚举22位,for循环不能跑太多,加上子层循环和判断,所以一般范围大概就是在22左右。int i = 0; i < 1 << 221 << 30是1e9超过int类型需要转换为long long类型1ll << 301ll << 60二进制枚举范围为0到2^n - 1。例题import java.util.Scanner;public class Main { // 15个
2020-10-09 13:07:02 261
原创 背包九讲总结
背包九讲总结n件物品,背包容量为m。物品体积为v,价值为w。01背包模板for(int i = 0; i < n; i ++) { for(int j = m; j >= v[i]; j --) { dp[j] = Math.max(dp[j], dp[j - v[i]] + w[i]); }}System.out.println(dp[m]);完全背包模板for(int i = 0; i < n; i ++) { for(int j = v[i]; j <
2020-10-08 12:55:00 199 4
原创 第十一届蓝桥杯大赛软件类省赛Java大学B组(第一场)
第十一届蓝桥杯大赛软件类省赛Java大学B组(第一场)YeRikGSunlRzgDlvRwYkXkrGWWhXaAimport java.util.Date;import java.text.ParseException;import java.text.SimpleDateFormat;public class Main { public static void main(String[] args) throws ParseException { SimpleDateFor
2020-10-05 18:00:10 3138 5
原创 Java优先队列
Java优先队列Java优先队列默认为最小堆PriorityQueue<Integer> p = new PriorityQueue<Integer>();for(int i = 1; i <= 10; i ++) p.add(i);System.out.println(p.poll());运行结果为1重写compare函数得到最大堆static class cmp implements Comparator <Integer>{ public
2020-09-25 15:55:35 280
原创 最长上升子序列
最长上升子序列模板动态规划#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>using namespace std;int num[100000 + 10];int dp[100000 + 10];int main(){ int n; scanf("%d", &n); for(
2020-09-05 20:22:32 135
原创 卡特兰数模板
卡特兰数卡特兰数又称卡塔兰数,是组合数学中一个经常出现在各类计数问题中的数列。其前几项为:1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, 6564120420, 24466267020, 91482563640, 343059613650, 1289904147324, 48619464
2020-07-25 21:29:08 480
原创 第十一届蓝桥杯软件类C/C++大学B组省赛
第十一届蓝桥杯大赛软件类省赛C/C++大学B组试题答案:3880public class Main { public static void main(String[] args) { int tot = 10000; boolean go = true; int ans = 0; while(true && tot >= 0) { if(go) { if(tot - 600 < 0) break; tot -= 600;
2020-07-19 11:47:17 1938
原创 POJ 2528 Mayor's posters
Mayor’s postershttps://vjudge.net/problem/POJ-2528The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all ...
2020-04-22 20:52:32 172
原创 ZOJ 1610 Count the Colors
Count the Colorshttps://vjudge.net/problem/ZOJ-1610Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the se...
2020-04-22 09:17:04 227
原创 HDU 1698 Just a Hook
Just a Hookhttps://vjudge.net/problem/HDU-1698In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic s...
2020-04-21 09:29:04 211
原创 第二届“传智杯”全国大学生IT技能大赛(决赛)部分题解
传送门题目描述传智专修学院里有 n 栋教学楼,有 m 条双向通行道路连接这些教学楼,不存在重边和自环。每条道路都有一定的长度,而且所有教学楼之间都可以直接或者间接的通过道路到达。我们可以很容易的求出这些教学楼之间的最短路。为了使交通更为顺畅,校方决定在两个教学楼里增设一对传送门。传送门可以将这对教学楼的距离直接缩短为 0。利用传送门,某些教学楼之间的最短路的距离就变短了。由于预算有限,学校...
2020-04-20 18:14:44 1300
原创 POJ 3468 A Simple Problem with Integers
A Simple Problem with Integershttps://vjudge.net/problem/POJ-3468You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number...
2020-04-17 20:37:26 197
原创 POJ 3264 Balanced Lineup
Balanced Lineuphttps://vjudge.net/problem/POJ-3264For the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ult...
2020-04-17 16:16:07 174
原创 HDU 1754 I Hate It
I Hate Ithttp://acm.hdu.edu.cn/showproblem.php?pid=1754Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题...
2020-04-17 11:09:55 206
原创 HDU 1166 敌兵布阵
敌兵布阵http://acm.hdu.edu.cn/showproblem.php?pid=1166Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌...
2020-04-17 09:37:00 193
原创 HDU 1213 How Many Tables
How Many Tableshttps://vjudge.net/problem/HDU-1213Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have t...
2020-04-16 15:41:53 176
原创 POJ 1611 The Suspects
The Suspectshttps://vjudge.net/problem/POJ-1611Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize ...
2020-04-16 14:33:23 234
原创 POJ 2236 Wireless Network
Wireless Networkhttps://vjudge.net/problem/POJ-2236An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an u...
2020-04-16 11:01:45 216
原创 蓝桥杯2020年4月模拟赛部分试题
蓝桥杯2020年4月模拟赛问题描述小明和朋友们一起去郊外植树,他们带了一些在自己实验室精心研究出的小树苗。小明和朋友们一共有n个人,他们经过精心挑选,在一块空地上每个人挑选了一个适合植树的位置,总共n个。他们准备把自己带的树苗都植下去。然而,他们遇到了一个困难:有的树苗比较大,而有的位置挨太近,导致两棵树植下去后会撞在一起。他们将树看成一个圆,圆心在他们找的位置上。如果两棵树对应的圆相交...
2020-04-15 18:18:01 4357 4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人