自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Sophon

Brooding renders me prophetic

  • 博客(59)
  • 收藏
  • 关注

原创 C++计算器

Calculator.h#ifndef CALCULATOR_H#define CALCULATOR_H#include <string>#include <iostream>#include <cmath>#include <stack>#include <sstream>#include <algorithm&...

2019-05-02 09:31:22 523

原创 P3369 【模板】普通平衡树 STL版

原题传送门#include <iostream>#include <algorithm>#include <cstdio>#include <vector>using namespace std;vector<int> v;int main(){ ios::sync_with_stdio(false); cin.t...

2019-04-23 12:41:52 219

原创 Luogu P3865 【模板】ST表

原题传送门#include <bits/stdc++.h>using namespace std;inline int read(){ char c=getchar();int x=0,f=1; while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();} while(c>='0'&&amp...

2019-04-05 15:43:57 134

原创 P3372 【模板】线段树 1

原题传送门#include <bits/stdc++.h>using namespace std;const int N = 1000001;typedef long long ll;ll n,m,a[N],ans[N<<2],tag[N<<2];inline ll leftSon(ll x){ return x<<1;...

2019-04-05 10:11:38 105

原创 校赛 折返跑

小明和小红在 100m100m100m 跑道上练习折返跑,小明以 aaa 米每秒的速度匀速跑步,小红以 bbb 米每秒的速度匀速跑步,小明跑得比小红快(即 a&gt;ba&gt;ba>b )。假设他们同时出发,问小红跑一个来回的时间内,小明和小红相遇了几次。注意起点处不算相遇,若两人在结束时同时到达终点处则算相遇(具体可参见样例)。输入格式第一行一个整数 TTT (1≤...

2019-03-30 14:32:25 390

原创 高精度

HugeInt.h#ifndef HUGEINT_H#define HUGEINT_H#include <iostream>#include <string>using std::ostream;using std::string;class HugeInt{ friend ostream &operator<<(ostream &a...

2019-03-23 22:08:46 217

原创 比值法根值法

比值法求极限设有极限lim⁡n→∞{\lim_{n \to \infty}}limn→∞​ ∣anan−1∣=q\left |\cfrac{a_n}{a_{n-1}}\right | =q∣∣∣∣∣​an−1​an​​∣∣∣∣∣​=q ,若q&amp;amp;amp;lt;1q&amp;amp;amp;lt;1q&amp;amp;lt;1,则 lim⁡n→∞an=0{\lim_{n \to \infty}} a_n=0limn→∞​an​...

2019-03-03 16:08:09 3775

原创 Luogu P1135 奇怪的电梯

原题传送门DFS版#include &lt;bits/stdc++.h&gt;using namespace std;int N;int num[205];bool vis[205];int beg, end;int minn = 0x7f7f7f7f;void dfs(int now, int step){ if (now == end) { minn = min...

2019-03-03 13:36:29 144

原创 Luogu 月赛 P5239 回忆京都

原题传送门#include &lt;bits/stdc++.h&gt;typedef long long ll;using namespace std;const int MOD = 19260817;ll a[1005][1005];//a[down][up]ll sum[1005][1005];int main(){ ios::sync_with_stdio(false...

2019-03-02 21:15:57 172

原创 Luogu 月赛 P5238 整数校验器

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;bool valid(string s){ if (s == "0") return true; if (s == "-")//巨坑无比 return false; if (s[0] == '-'&amp;&amp;s[1] == '0') return fal...

2019-03-02 20:23:57 224

原创 Luogu P2068 统计和

原题传送门#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;int c[100005];int a[100005];int n;int lowbit(int x){ return x &amp;amp; (-x);}int Sum(int i){ int res = 0; while (i &amp;gt; 0) { res +...

2019-03-02 18:54:05 117

原创 Luogu P2690 接苹果

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int f[1005][35];//f[时间][移动次数]=最大接到苹果数 int T,W;//总时间,最大移动次数 int app[1005];//下落地点 int dfs(int t_now,int last_pos,int move)//当前位置,上次的地点,移动次数...

2019-03-02 14:15:59 226

原创 Luogu P1004 方格取数

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int mp[15][15];int f[15][15][15][15];//将走到目的地回头转化为两个人从起点开始走,f[i][j][k][l]表示两人走到(i,j)和(k,l)时的最大值int Max(int a, int b, int c, int d)//取最大值函数...

2019-02-28 19:04:12 104

原创 快速积 幂 模

快速积 a*b#include &lt;bits/stdc++.h&gt;using namespace std;typedef long long ll;ll FastMul(ll a, ll b){ ll ans=0; while(b) { if(b&amp;1) { ans+=a; } a+=a; b&gt;&gt;=1; } return a...

2019-02-28 16:29:14 98

原创 快速幂模 a^b%p

经典版#include &lt;iostream&gt;using namespace std;typedef long long ll;ll work(ll base, ll exponent, ll mod){ ll temp = 1; while (exponent != 0) { if (exponent % 2 == 1) { exponent--; ...

2019-02-28 14:21:59 333

原创 文本分割为不同单词

将字符串分割出不同单词,按字典序输出纯STL + iterator + set 版#include &lt;iostream&gt;#include &lt;string&gt;#include &lt;set&gt;#include &lt;vector&gt;#include &lt;algorithm&gt;using namespace std;void splitStr...

2019-02-28 12:27:58 291

原创 Luogu P1855 榨取kkksc03

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;struct man { int tim; int mon;};int n, M, T;man in[210];int f[210][210][210];//step,m,tint dfs(int step, int t_left, int m_left){ if...

2019-02-25 15:56:52 101

原创 Luogu P1006 传纸条

原题传送门#include &lt;bits/stdc++.h&gt;const int M = 55;using namespace std;int f[M * 2][M][M];int a[M][M];int Max(int a, int b, int c, int d){ int t[4]; t[0] = a; t[1] = b; t[2] = c; t[3] =...

2019-02-25 15:04:45 70

原创 Luogu P1387 最大正方形

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int mp[105][105];int ans[105][105];int main(){ int n, m; cin &gt;&gt; n &gt;&gt; m; for (int i = 1; i &lt;= n; i++) { for (int j =...

2019-02-23 09:45:49 101

原创 Luogu P1363 幻想迷宫

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;const int N = 1500 + 5;bool mp[N][N];int vis[N][N][3];//[][][0] x; [][][1] y; [][][2] vis or notint movex[] = { 0,-1,0,1 };int movey[] = ...

2019-02-23 09:35:20 88

原创 Luogu P1908 逆序对

原题传送门#include &lt;bits/stdc++.h&gt;typedef long long ll;using namespace std;const ll N = ll(5e5 + 4);ll n;ll a[N];//输入的原数组 ll sorted[N];//排好的数组 ll ans;//总逆序对数 void mergeSort(int left, int r...

2019-02-22 15:34:08 128

原创 Luogu P1282 多米诺骨牌

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;const int N = 1004;const int INF = 0x7f7f7f7f;int fewest_time[N][6 * N];//[i][j]=[前i个][up和为j]最少交换次数int up[N], down[N];//上下层数组int main()...

2019-02-21 16:14:43 62

原创 Luogu P1091 合唱队形

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int n;int a[105];//身高序列int head_to_tail[105];//方向从头到尾,到第i个为止,包含第i个在内,a[]的最长上升子序列(非连续)的长度int tail_to_head[105];//方向从尾到头,到第i个为止,包含第i个在内,a[]的...

2019-02-21 11:11:17 110

原创 Luogu P1236 算24点

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int in[5];int calc(int operName, int x, int y){ if (operName == 1)//+ { return x + y; } if (operName == 2)//- { if (x - y &lt;=...

2019-02-20 20:55:13 271

原创 Luogu P1216 [IOI1994][USACO1.5]数字三角形 Number Triangles

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int f[1005][1005];//f[i][j]是走到i行j列时最大值int main(){ int row;//行数 cin &gt;&gt; row; int in; for (int i = 1; i &lt;= row; i++) { for (...

2019-02-20 15:43:51 184

原创 二叉树 其他

统计叶子数int CountLeafNode(BinTree bt){ if(bt==NULL) { return 0; } if(bt-&gt;leftchild==NULL&amp;&amp;bt-&gt;rightchild==NULL) { return 1; } return (CountLeafNode(bt-&gt;leftchild)+CountLea...

2019-02-20 15:07:45 89

原创 二叉树(非递归)

#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;typedef char DataType;typedef struct BTreeNode{ DataType data; struct BTreeNode * leftchild; struct BTreeNode * rightchild; }BinTreeNode;typ...

2019-02-20 14:33:31 710

原创 二叉树(递归)

文章目录类型定义先序遍历中序遍历后序遍历层序遍历建树完整类型定义typedef char DataType;typedef struct BTreeNode{ DataType data; struct BTreeNode * leftchild; struct BTreeNode * rightchild; }BinTreeNode;typedef BinTreeNode * ...

2019-02-19 20:19:48 6250

原创 数独

#include &lt;bits/stdc++.h&gt;using namespace std;struct consult_row_0 { int row, num_0;};struct consult_row_0 dic_row_0[10];int origin[10][10];bool row[10][10], column[10][10], box[10][10];...

2019-02-19 16:09:57 104

原创 Luogu P1074 靶形数独

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;struct consult_row_0 {//定义结构体,把行和这一行上0的个数捆绑起来 int row, num_0;};struct consult_row_0 dic_row_0[10];//查询第几行有几个0int origin[10][10];//输入的数独...

2019-02-18 15:16:12 73

原创 Luogu P1010 幂次方

原题传送门#include &lt;iostream&gt;#include &lt;cmath&gt;using namespace std;void work(int n){ if (n == 0) { return; } int maxx = log2(n);//寻找小于n的最大的二次幂 if (maxx == 0) { cout &lt;&lt; "2(0...

2019-02-18 10:26:11 79

原创 Luogu P2097 资料分发1

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;vector&lt;int&gt; link[100005];//存连接线,link[t]是一个由第t个点所有连接点组成的vectorbool vis[100005];//记录是否访问过int pointNum, linkNum;void dfs(int x){ vis...

2019-02-17 20:02:35 161

原创 Luogu P1164 小A点菜

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int ans[105][10005];//ans[i][j]表示在第i道菜之前花完j元的方法数,在main外已初始化为0int price[105];//价格int main(){ int n, m; cin &gt;&gt; n &gt;&gt; m; for ...

2019-02-17 19:31:22 309

原创 Luogu P1434 [SHOI2002]滑雪

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;int x_n, y_n;int height[105][105];int dis[105][105];int movex[] = { 0,0,1,-1 };int movey[] = { -1,1,0,0 };int dfs(int x, int y){ if ...

2019-02-17 16:03:50 92

原创 Luogu P1433 吃奶酪

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;double dis[20][20];//存两点间距离,dis[i][j]表示第i个点到第j个点距离double point[20][2];//存坐标bool walk[20];//记录点是否被访问过int n;//总点数double ans = 1e9;//距离最小值...

2019-02-17 15:05:51 305

原创 Luogu P1141 01迷宫

原题传送门#include &lt;bits/stdc++.h&gt;using namespace std;char mp[1005][1005];//存图int ans[1005][1005];//存最后答案bool vis[1005][1005];//记录是否访问过int n;//边界int movex[] = { 0,0,-1,1 };//移动int movey[] = ...

2019-02-17 10:32:52 87

原创 Luogu P1443 马的遍历

原题传送门#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;int movex[] = { 1,1,2,2,-1,-1,-2,-2 };int movey[] = { -2,2,-1,1,2,-2,1,-1 };int x_n, y_n;int ans[405][405];bool walk[405][405];queue&amp;lt;...

2019-02-16 21:54:36 131

原创 CF900B Position in Fraction

原题传送门#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;int main(){ int a, b, c; cin &amp;gt;&amp;gt; a &amp;gt;&amp;gt; b &amp;gt;&amp;gt; c; for (int i = 1; i &amp;lt;= 300; i++) { a *= 10; if (a /

2019-02-16 17:46:34 113

原创 CF495B Modular Equations

原题传送门#include &amp;lt;bits/stdc++.h&amp;gt;using namespace std;int main(){ int a, b; cin &amp;gt;&amp;gt; a &amp;gt;&amp;gt; b; if (a == b) { cout &amp;lt;&amp;lt; &quot;infinity&quot; &amp;lt;&a

2019-02-16 14:14:56 115

原创 继承 c++

#include &amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;gt;using namespace std;class Hero{ private: int HP,ATK; string name; public: void setHP(int); void setATK(int); void setName(string); int getHP(); int ge...

2019-02-14 21:22:43 93

空空如也

空空如也

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

TA关注的人

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