自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(123)

原创 C++ 读入优化 程序设计竞赛中加速读入

int readInt(){ int x=0; bool sign=false; char c=getchar(); while(!isdigit(c)){ sign=c=='-'; c=getchar(); } while(isdigit(c)){ x=x*10+c-'0'; c=g...

2019-08-15 14:50:24 132

原创 tyut 计算机科学方向新生学习指导

相关准备:1.选择电脑:2019.7笔记本推荐指南by tyut程序爱好者协会 编辑by@tyut程序爱好者协会笔吧夏蒙乾 20192.训练平台:vjudgePOJ​ ZOJ​UVALive​SGU​URAL​HUST​SPOJ​HDU​HYSBZ​UVA​CodeForces​Z-Trening​Aizu​LightOJ​UESTC​NBUT​FZU...

2019-08-01 16:34:14 268

原创 PAT(Advanced Level) 1015 Reversible Primes (20分)

PAT(Advanced Level) 1015 Reversible Primes (20分)A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a rev...

2020-02-26 14:01:58 71

原创 PAT (Advanced Level) 1014 Waiting in Line (30分)

PAT (Advanced Level) 1014 Waiting in Line (30分)Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules f...

2020-02-25 18:45:39 87

原创 PAT (Advanced Level) 1013 Battle Over Cities (25分)

PAT (Advanced Level) 1013 Battle Over Cities (25分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that ...

2020-02-22 14:43:45 65

原创 PAT (Advanced Level) 1012 The Best Rank (25分)

PAT (Advanced Level) 1012 The Best Rank (25分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathema...

2020-02-22 14:16:30 60

原创 PAT(Advanced Level) 1011 World Cup Betting (20分)

PAT(Advanced Level) 1011 World Cup Betting (20分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing bat...

2020-02-20 18:19:38 53

原创 PAT (Advanced Level) 1010 Radix (25分)

PAT (Advanced Level) 1010 Radix (25分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary numb...

2020-02-20 12:05:46 69

原创 PAT(Advanced Level) 1009 Product of Polynomials (25分)

PAT(Advanced Level) 1009 Product of Polynomials (25分)This time, you are supposed to find A×B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case ...

2020-02-18 16:57:31 50

原创 PAT(Advanced Level) 1008 Elevator (20分)

PAT(Advanced Level) 1008 Elevator (20分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will ...

2020-02-18 15:58:55 51

原创 PAT(Advanced Level) 1007 Maximum Subsequence Sum (25分)

PAT(Advanced Level) 1007 Maximum Subsequence Sum (25分)Given a sequence of K integers { N1N_1N1​​, N​2N_​2N​​2​, …, NKN_KNK​}. A continuous subsequence is defined to be { NiN_iNi​​​ , Ni+1N_{i+1}Ni+1​...

2020-02-17 21:15:16 34

原创 PAT(Advanced Level) 1006 Sign In and Sign Out (25分)

PAT(Advanced Level) 1006 Sign In and Sign Out (25分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the do...

2020-02-15 20:42:20 38

原创 PAT (Advanced Level) 1005 Spell It Right (20分)

PAT (Advanced Level) 1005 Spell It Right (20分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification...

2020-02-15 17:32:33 46

原创 PAT (Advanced Level) 1004 Counting Leaves (30分)

PAT (Advanced Level) 1004 Counting Leaves (30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input...

2020-02-15 17:18:11 44

原创 PAT (Advanced Level) Practice 1003 Emergency (25分)

PAT (Advanced Level) Practice 1003 Emergency (25分)#include <bits/stdc++.h>using namespace std;int n, m;vector<pair<int, int>> graph[505];int d[505], vis[505], roadnum[505];lon...

2020-02-15 16:10:44 48

原创 PAT (Advanced Level) Practice 1002 A+B for Polynomials (25分)

This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informati...

2020-02-12 21:53:36 47

原创 PAT (Advanced Level) Practice 1001 A+B Format

Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input f...

2020-02-12 21:22:11 52

原创 CCF-CSP 认证 201909-3 字符画

CCF-CSP 认证 201909-3 字符画这题有毒,没写对,感觉题意理解有点问题,下次再补。

2020-02-12 20:40:16 105

原创 CCF-CSP认证 201909-2小明种苹果(续)

CCF-CSP认证 201909-2小明种苹果(续)#include <bits/stdc++.h>using namespace std;int n, D, E;bool flag[1005];int a[1005];int pre(int x){ if (x == 0) return n - 1; else return x -1;}int su...

2020-02-11 15:05:00 69

原创 CCF-CSP 认证 201909-1 小明种苹果

CCF-CSP 认证 201909-1 小明种苹果#include <bits/stdc++.h>using namespace std;int n, m;struct tree{ int num; int id;}a[1005];long long tot;bool cmp(tree a, tree b){ return a.num == b....

2020-02-10 20:52:13 92

原创 CCF-CSP 201912-4区块链

CCF-CSP 201912-4区块链看了大佬博客(https://blog.csdn.net/richenyunqi/article/details/104155384)以后写的,本来想着看完按自己思路写,但是最后写出来差不多,但是我80分,运行超时。#include <bits/stdc++.h>using namespace std;map<int, unorde...

2020-02-10 16:39:06 663

原创 CCF-CSP 201912-3化学方程式

CCF-CSP 201912-3化学方程式满分代码:#include <bits/stdc++.h>using namespace std;string str;map<string, int> lc, rc;vector<string> solve(string s){ s = s + "+"; vector<string...

2020-01-20 09:52:48 704

原创 CCF-CSP 201912-2回收站选址

回收站选址#include <bits/stdc++.h>using namespace std;int ans[6];map <pair<int , int>, int> g;//垃圾的位置int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i...

2020-01-16 09:47:10 333

原创 CCF-CSP认证 201912-1报数

CCF-CSP认证 201912-12报数#include <bits/stdc++.h>using namespace std;int judge(int x){ if (x % 7 == 0) return 1; while (x){ if (x % 10 == 7) return 1; x /= 10; } ...

2020-01-16 09:22:43 494

原创 算符优先算法 编译原理

#include <bits/stdc++.h>#define FOR(i,s,t) for(int i=(s);i<=(t);i++)#define ROF(i,s,t) for(int i=(s);i>=(t);i--)#define pb push_back#define mp make_pair#define eb emplace_back#defin...

2019-11-25 13:53:16 112

原创 BZOJ 2595 wc2008 浏览计划 [斯坦纳树]

斯坦纳树裸题但是本题的斯坦纳树是点权,与大多数图的边权不同,下边讲解一般的边权做法,然后再将本题的题解。斯坦纳树:给出一些点,选出若干条边使得这些点连通,求总边权的最值。斯坦纳树是NP问题,不存在多项式时间内的解法,求解方法是状压dp。设f[i][j]表示选择若干条边,使得状态为ii的给定点连通,并且当前可以选择下一条边的端点为jj的最小边权和。初始状...

2019-10-07 22:55:50 154

原创 csu 2169 排列 2019牛客国庆day3 [状压dp]

题意:给一个长度为 n 的序列 和 m 个二元组. 排列数列 p,使得最小题解:按序放置元素,状态表示位置是否为空。Bitcnt(status)表示此时该选择的元素。ele=p[bitcnt(pre)]若我们以当前状态中所包含的二元组的绝对值作为状态取值的话,状态内部元素的排序方式对状态转移会有影响。绝对值可以理解成,较大值贡献正权,较小值贡献负权。我们可以将状态取值设为:当前...

2019-10-04 22:00:25 76

原创 牛客国庆day3 Grid [线段树]

Bobo has points arranged into a matrix with n rows and m columns. The points in the intersection of the i-th row and the j-th column is labeled with (i, j).He is going to perform q operations of the...

2019-10-04 16:20:19 85

原创 母函数模板

(x^(v[0]*n1[0])+x^(v[0]*(n1[0]+1))+x^(v[0]*(n1[0]+2))+...+x^(v[0]*n2[0]))(x^(v[1]*n1[1])+x^(v[1]*(n1[1]+1))+x^(v[1]*(n1[1]+2))+...+x^(v[1]*n2[1]))...(x^(v[K]*n1[K])+x^(v[K]*(n1[K]+1))+x^(v[K]*(n1[K...

2019-10-02 23:47:27 52

原创 母函数 生成函数 模板 HDU 1398 Square Coins

题意:给出n,求n只有平方数组成的划分题解:显然n的划分数等于(1+x+x^2+...)*(1+x^4+x^8+...)*(1+x^9+x^16+...)*(1+x^的结果中x^n次前的系数#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 200;int...

2019-10-01 18:01:26 56

原创 母函数 生成函数 模板 HDU 1028 Ignatius and the Princess III

题意:给出一个N,问N的划分数题解:显然n的划分数等于(1+x+x^2+...)*(1+x^2+x^4+...)*(1+x^3+x^6+...)的结果中x^n次前的系数#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 200;int n;int c1[...

2019-10-01 17:46:29 45

原创 指数型母函数 生成函数 [2019上海网络赛 E题 Counting Sequences II]

泰勒展开公式常见公式。指数型母函数例题Counting Sequences II题意:构造一盒序列a[1,n],满足1<=a[i] <=m,其中偶数出现的次数是偶数次#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn...

2019-10-01 16:11:48 118

原创 洛谷P4157 [SCOI2006]整数划分 高精度乘法[FFT 快速傅里叶变换]

题目描述从文件中读入一个正整数n(10≤n≤31000)。要求将n写成若干个正整数之和,并且使这些正整数的乘积最大。例如,n=13,则当n表示为4+3+3+3(或2+2+3+3+3)时,乘积=108为最大。输入格式只有一个正整数:n (10≤n≤31000)输出格式第1行输出一个整数,为最大乘积的位数。第2行输出最大乘积的前100位,如果不足100位,则按实际位数输出最...

2019-09-28 10:30:19 136

原创 HDU 4609 3-idiots [FFT 快速傅里叶变换]

3-idiots Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10046Accepted Submission(s): 3406 Problem Description ...

2019-09-27 19:33:13 93

原创 2019上海网络赛 C [FFT 快速傅里叶变换]

题意:给出三组数组,从每个数组里挑出一个数组成一个三元组(a,b,c),使得这三个数可以组成三角形题解:由于题目n>1000的组数不超过20, FFT的大小与数量无关与最大值有关题源:这题是 HDU 4609 的改编https://blog.csdn.net/Adolphrocs/article/details/101555137/* *FFT */#include &l...

2019-09-27 19:27:00 71

原创 CEOI2019 / CodeForces 1192B. Dynamic Diameter

题意:给出一个带权树,每次修改树上一条边的权值,询问树的直径题解:https://www.cnblogs.com/TinyWong/p/11260601.html线段树维护全DFS序#include <bits/stdc++.h>#define FOR(i,s,t) for(int i=(s);i<=(t);i++)#define ROF(i,s,t) for(in...

2019-09-22 17:28:06 112

转载 动态树LCT基本操作的简明代码

洛谷P3690 【模板】Link Cut Tree (动态树)(点击进入题目)#include<bits/stdc++.h>#define R register int#define I inline void#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))#define lc c[x][0]#define rc c...

2019-09-20 13:13:38 60

原创 [BZOJ - 2243] 染色 (动态树LCT)

题意:给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。“C a b c”表示这是一个染色操作,把节点a到节点b路径上所有点(包括a和b)都染成颜色c;“Q a...

2019-09-20 10:45:04 60

原创 [Codeforces 242.E] XOR on Segment(线段树)

E. XOR on Segmenttime limit per test:4 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputYou’ve got an arrayaa, consisting ofnnintegersa1,a2,…,an. You are ...

2019-09-18 21:46:36 73

原创 BZOJ 2154 莫比乌斯反演 Crash的数字表格

BZOJ 2154 莫比乌斯反演 Crash的数字表格题意:∑i=1n∑j=1mlcm(i,j)\sum_{i=1}^{n}\sum_{j=1}^{m} lcm(i,j)∑i=1n​∑j=1m​lcm(i,j)#include <bits/stdc++.h>#define FOR(i,s,t) for(int i=(s);i<=(t);i++)#define ROF(i...

2019-09-03 14:17:17 93

空空如也

空空如也

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