- 博客(62)
- 收藏
- 关注
原创 Chat Group(快速幂)
还有一个规律 :C(n,i+1)=C(n,i)*((n-i+1)/i);杨辉三角 可以直接有2^n的快速幂算出来#include<iostream>#include<string>#include<cstdio>#define mod 1000000007using namespace std;long long extend_gcd(...
2018-08-31 21:08:01 962
原创 SOS(博弈论)
在简单的情况下,一一枚举,发现S_ _S 这种情况 先进空格谁先输所以当n为奇数的时候,先手 构S_ _S 后手防 当n为偶数的时候,先手防S_ _S 后手构从中间开始构 ,从中间开始防当 n 为 7 时 形成双头 防不住所以 >=7的奇数 先手必赢当 n为偶数 , 从中间 开始防,当一边为7 ,则防不住, 这时n为15 ,但n==15先手必胜所以...
2018-08-31 16:54:25 403
原创 pair 用法
pair的定义: pair<string,int> p ; pair<int ,int > p; pair<double,int> p; pair的赋值:利用 typedef pair<int ,int > P; 赋值的话就可以简化为 P(int ,int); 举个例子:q[i]=P(w[j...
2018-08-30 23:01:25 248
原创 HDU-6222 Heron and His Triangle
Heron and His Triangle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1423 Accepted Submission(s): 632 Problem Descript...
2018-08-30 19:31:44 233
原创 Grid Coloring (动态规划)
借鉴:https://www.cnblogs.com/clrs97/p/7841819.html#include<cstdio>typedef long long ll;const int N=40;int n,m,i,j,k;ll ans,f[N][N]; //f[i][j]表示考虑前i行,第i行前j个为B的种类,额,前0个有意思。char a[N][N];...
2018-08-29 22:31:13 362
原创 Make a Forest (三元组建图)
#include <bits/stdc++.h>using namespace std;#define MAXN 100010struct Node{ int u,v,w; //u,v,w有相比G[MAXN]好处 //三元组可以利用权值排序,而G不能排序}a[MAXN];bool cmp(Node a,Nod...
2018-08-28 20:42:00 395
原创 Binary Transformation(贪心 1 1)
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define MAXN 100010#define MAXM 5010long long c[MAXN];int n,cnt;char a[MAXN],b[MAXN...
2018-08-27 20:14:17 435
原创 High Score (三个平方和最小)
#include <cstdio>#include <algorithm>using namespace std;int main(){ int t; scanf("%d",&t); while(t--) { long long a[4],d; scanf("%lld%lld%lld%ll...
2018-08-27 13:15:53 394
原创 map细节补充
map<string,int> si for(map<string,int>::iterator it=si.begin();it!=si.end();it++) { cout<<it->first<<end; }这个竟然是按string的字典序输出的si.clear()就是map的清0 当...
2018-08-27 13:08:21 105
原创 Escape Room (贪心)
Escape Room利用 贪心排序,利用id还原真的是6这结构体的x,y也用的很巧妙#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;#define MAXN 100010struct Node{ int x,y; ...
2018-08-26 19:44:17 299
原创 费马定理
费马小定理:当p为质数时候, a^(p-1)≡1(mod p)。 a^p≡a(mod p)问:(m+n)p== mp+np 加和乘重新定义为什么运算才能满足条件 根据费马小定理:(m+n)p≡m+n≡mp+np mod p 所以只要将 + 重新定义为 m+n =(m+n) mod...
2018-08-25 20:04:22 759
原创 UVALive - 8080 (vector用法)
Christmas is coming and Bob wants to decorate his tree. The tree has N nodes. 1 is the root. He thinks a tree is beautiful if each node has exactly K child (immediate descendant) nodes (of course exce...
2018-08-25 08:38:01 138
原创 尺取法模板
int chiqu(){ int l = 0,r = 0; int ans = 0,len = MAXN; while(true) { while(r <= n && ans < S) r ++,ans += num[r]; if(ans < S) break; ...
2018-08-22 11:30:13 271
原创 Gym - 101810 I. Split the Number(拆分差最小)
I. Split the Numbertime limit per test1.0 smemory limit per test256 MBinputstandard inputoutputstandard outputYou are given an integer x. Your task is to split the number x into exac...
2018-08-21 22:43:49 332
原创 UVALive - 7198 Tall orders (构造函数等式二分求参数)
You have been charged with evaluating the safety of power cables passing over train tracks. Owing to the recent purchase of the new Macho 10000 trains, the questions has been raised as to whether the ...
2018-08-21 22:33:21 284
原创 栈的stl
stack<int> s; 创建一个空的堆栈对象 s stack<int, list<int> > s1; stack<int, list<int> > s2(s1); 利用 s1 ,创建一个以双向链表为底层容器的空堆栈对象 s2 。c++ stl栈stack的头文件为: #i...
2018-08-20 23:18:16 299
原创 list stl
简化了:https://blog.csdn.net/xiaoquantouer/article/details/70339869头文件#include<list>list<int> a;list<int>a{1,2,3}list<int>a(n) //声明一个n个元素的列表,每个元素都是0list<int>a(...
2018-08-20 23:14:01 86
原创 UVALive - 7197 (完全背包+位运算枚举)
You are running a machine shop producing custom axles for radio-controlled cars. These axles can be manufactured from either steel or stainless steel, with the stainless steel parts usually priced dif...
2018-08-20 22:12:42 187
原创 POJ-1201 Intervals(差分 最小值最长路)
IntervalsTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 30103 Accepted: 11643 DescriptionYou are given n closed, integer intervals [ai, bi] and n integers c1, ..., ...
2018-08-20 11:09:53 252
原创 HDU-5025 Saving Tang Monk(广搜+状态)
Saving Tang Monk Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3199 Accepted Submission(s): 1116 Problem Description ...
2018-08-19 10:44:38 224
原创 HDU-4848 Wow! Such Conquering!(A*)
Wow! Such Conquering! Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2683 Accepted Submission(s): 815 Problem Descriptio...
2018-08-18 20:50:38 250
原创 HDU-4360 As long as Binbin loves Sangsang (最短路+状态)
As long as Binbin loves Sangsang Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4094 Accepted Submission(s): 880 Problem ...
2018-08-18 00:45:26 150
原创 HDU-2544 最短路 (SPFA)
最短路 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 89115 Accepted Submission(s): 38600 Problem Description 在每年的校赛里,所有...
2018-08-17 13:36:35 123
原创 HDU-4405 Aeroplane chess (概率DP)
Aeroplane chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5986 Accepted Submission(s): 3723 Problem Description ...
2018-08-17 07:49:14 123
原创 POJ-2096 Collecting Bugs (概率DP)
Collecting BugsTime Limit: 10000MS Memory Limit: 64000K Total Submissions: 7822 Accepted: 3709 Case Time Limit: 2000MS Special Judge DescriptionIvan is fond of collec...
2018-08-16 20:32:32 144
原创 HDU-3586 Information Disturbing(树形DP+二分+处理边)
Information Disturbing Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 4467 Accepted Submission(s): 1512 Problem Descript...
2018-08-16 13:56:01 170
原创 POJ-2823 Sliding Window (单调队列)
Sliding WindowTime Limit: 12000MS Memory Limit: 65536K Total Submissions: 71156 Accepted: 20228 Case Time Limit: 5000MS DescriptionAn array of size n ≤ 106 is given to you. T...
2018-08-15 19:23:50 116
原创 HDU-2059 龟兔赛跑 (动态规划)
龟兔赛跑 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22636 Accepted Submission(s): 8310 Problem Description 据说在很久很久以前,...
2018-08-15 19:21:36 660
原创 FZU-2285 迷宫寻宝 (广搜模版)
Problem 2285 迷宫寻宝 Accept: 237 Submit: 878Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description洪尼玛今天准备去寻宝,在一个n*n (n行, n列)的迷宫中,存在着一个入口、一些墙壁以及一个宝藏。由于迷宫是四连通的,即在迷宫中的一个位置,只能走到与它直接相...
2018-08-15 11:29:36 372
原创 HDU-1007 Quoit Design(计算几何 平面最近点对)
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 64316 Accepted Submission(s): 17026 Problem Description ...
2018-08-15 08:55:11 230
原创 HDU-4911 Inversion(逆序对性质)
Inversion Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 6318 Accepted Submission(s): 2165 Problem Description bobo...
2018-08-15 00:55:21 512
原创 POJ-3659 Cell Phone Network(图的最小支配集+树形dp+处理点)
Cell Phone NetworkTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 7241 Accepted: 2581 DescriptionFarmer John has decided to give each of his cows a cell phone in hop...
2018-08-14 21:38:56 546
原创 LightOJ-1422 Halloween Costumes(区间DP)
1422 - Halloween Costumes PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween...
2018-08-14 13:05:11 198
原创 HDU-4055 Number String (dp+前缀和优化)
Problem Description The signature of a permutation is a string that is computed as follows: for each pair of consecutive elements of the permutation, write down the letter 'I' (increasing) if ...
2018-08-13 23:49:23 430
原创 HDU-1024 Max Sum Plus Plus(M段连续子段和+dp图表规律优化)
Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. ...
2018-08-13 20:46:27 157
原创 D. Holidays(C(n,m)和杨辉三角的模)
Everyone knows that the battle of Endor is just a myth fabled by George Lucas for promotion of his movie. Actually, no battle of Endor has happened and the First Galactic Empire prospers to this day....
2018-08-13 12:49:48 194
原创 HDU-6377 度度熊看球赛(正向dp)
Problem Description世界杯正如火如荼地开展!度度熊来到了一家酒吧。有 NNN 对情侣相约一起看世界杯,荧幕前正好有 2×N2 \times N2×N 个横排的位置。所有人都会随机坐在某个位置上。当然,如果某一对情侣正好挨着坐,他们就会有说不完的话,影响世界杯的观看。一般地,对于一个就座方案,如果正好有 KKK 对情侣正好是挨着坐的,就会产生 DKD^KDK...
2018-08-12 16:39:59 352
原创 E. Two Labyrinths(双图BFS)
E. Two Labyrinthstime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputA labyrinth is the rectangular grid, each of the cells of which is either ...
2018-08-11 23:15:22 457
原创 HDU-1016 Prime Ring Problem(素数环)
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 66131 Accepted Submission(s): 28321 Problem Description...
2018-08-11 22:14:45 139
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人