自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 PATA 1018

以下代码全都不对,则良机重写!1018. Public Bike Management (30)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at a...

2018-03-31 08:35:04 239

原创 PATA 1030

Travel Plan (30)A traveler''s map gives the distances between cities along the highways,together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide...

2018-03-31 08:34:54 143

原创 ANOJ 1008 进击的二叉查找树 (判断两棵BST是否完全一致)

Test: 判断两棵BST是否完全一致【Thinking】1. 分别建两棵BST,然后把它们遍历到数组中,判断两个数组是否一致2. 直接建两棵CBST,然后直接比较数组,省去了1法中的遍历的过程3. 建一棵BST,判别其他序列是否与该树一致4. 不建BST...?-------- 代码1 建一棵BST,判别其他序列是否与该树一致 --------#include <cst...

2018-03-31 08:34:46 250

原创 1099 Build A Binary Search Tree (30)

Build A Binary Search Tree (30)BST的定义:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys...

2018-03-31 08:34:42 161

原创 1064 Complete Binary Search Tree (30)

Complete Binary Search Tree (30)BST的定义:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with key...

2018-03-31 08:34:38 378

原创 1043 Is It a Binary Search Tree (25)

Is It a Binary Search Tree (25)二叉搜索树的定义:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with ke...

2018-03-31 08:34:34 202

原创 ANOJ 180315 C

//https://logn.me/problem/1024//10 8//2 6 1 2 0 9 5 0 3 6//0 1//0 2//0 3//1 4//1 5//3 6//7 8//8 9//2//775 36#include <cstdio>#include <vector>using namespace std;const ...

2018-03-31 08:34:26 121

原创 PATA 1106

Lowest Price in Supply Chain (25)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting fro...

2018-03-31 08:34:04 146

原创 PATA 1094

The Largest Generation (25)A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation w...

2018-03-29 20:40:19 171

原创 PATA 1090

Highest Price in Supply Chain (25)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting fr...

2018-03-29 20:39:48 198

原创 PATA 1079

Total Sales(所有零售商总共卖多少钱) of Supply Chain (25)A supply chain(供应链) is a network of :retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to cus...

2018-03-29 20:38:34 240

原创 PATA 170304 D

//Suppose that all the keys in a binary tree are distinct positive integers. //A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. //And it is a simp...

2018-03-29 20:15:48 122

原创 1020 Tree Traversals (25)

Tree Traversals (25)Suppose that all the keys in a binary tree(二叉树) are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...

2018-03-29 20:12:34 188

原创 1086 Tree Traversals Again (25)

Tree Traversals Again (25)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1...

2018-03-29 20:11:13 158

原创 PATA 1102

Invert(反) a Binary Tree (25)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck...

2018-03-29 20:09:27 147

原创 ANOJ 1005 还原二叉树

// 层序中序 求先/后序// ANOJ-180311-D#include <cstdio>const int MAXN = 10010;int n, layer[MAXN], in[MAXN];struct node { int data; node* l; node* r; };node* create(int *layer, int *in, int t) ...

2018-03-29 20:04:19 200

原创 对拍工具

//From wangfy#include <cstdio>#include <map>#include <cstring>#include <string>using namespace std;int main() { map<string,bool>mapp; char s[20]; int n...

2018-03-29 11:33:36 188

原创 历届试题 核桃的数量

#include <stdio.h>int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }int solve(int a, int b) { return a*b/gcd(a,b);}int main() { int a, b, c; scanf("%d%d%d",&a,&b,&c...

2018-03-28 21:25:58 156

原创 15年第六届蓝桥杯 c/c++ b组 题解(更新中)

1. 奖券数目 答案:52488公式:8*9*9*9*9#include <cstdio> int main() { int sum = 0; for(int i=10000; i<=99999; i++) { if(i/10000%10 == 4 || i/1000%10 == 4 ||i/100%10 == 4 ||i/10%10 == 4 || i%10 ...

2018-03-28 16:34:08 245

原创 16年第七届蓝桥杯 c/c++ b组 题解

http://blog.csdn.net/y1196645376/article/details/697181921. 煤球数目  答案:171700#include <cstdio>int N = 100, sum1 = 0;int solve(int x) { int sum2 = 0; for(int i=1; i<=x; i++) sum2 += i; ...

2018-03-27 10:43:08 234

原创 ALGO-5 最短路(待续)

#include <cstdio>#include <vector>using namespace std;const int MAXN = 110;const int INF = 1000000000;int N, M, G[MAXN][MAXN], d[MAXN];bool vis[MAXN];void Dijkstra(int x) { fill(...

2018-03-26 22:06:30 119

原创 扩展欧几里得算法

扩展欧几里得算法是对欧几里得算法的扩展。首先,欧几里得算法:int gcd(int a, int b) { return !b ? a : gcd(b, a % b);}四部分:    1. 扩展欧几里得算法,方程 ax + by = gcd(a, b) 的求解    2. 方程 ax + by = c 的求解    3. 同余式 ax ≡ c(mod m) 的求解    4. 逆元的求解 以...

2018-03-25 17:28:37 716 1

原创 ALGO-3 K好数

代码1,运行超时,只过了3点#include <cstdio>typedef long long ll;const ll MAXN = 110;const ll x = 1000000007;ll K, L, cnt = 0;bool vis[MAXN][MAXN];bool isOk(ll index,ll x) { int i = index - 1; if(i...

2018-03-24 16:07:52 124

原创 ALGO-2 最大最小公倍数

#include <stdio.h>typedef long long ll;int main(){ // 从1~n中任选出三个数,他们的最小公倍数最大为多少 ll n, max = 0; scanf("%d",&n); if(n<=2) max = n; else if(n % 2 != 0) max = n * (n-1) * (n-2); else...

2018-03-23 08:15:21 202

原创 17年第八届蓝桥杯 c/c++ b组 题解

http://blog.csdn.net/y1196645376/article/details/697181921. 购物单 答案:5136.859500,即5200#include <cstdio>int main() { double sum = 0.0; for(int i=0;i<50; i++) { double a, b; scan...

2018-03-22 19:50:12 402

原创 ALGO-1 区间k大数查询

#include <cstdio>#include <algorithm>using namespace std;const int MAXN = 1010;bool cmp(int a, int b) { return a > b;}int main() { int n, m ,number[MAXN]; scanf("%d"...

2018-03-22 12:20:18 192

原创 BASIC-1 闰年判断

#include <cstdio>int main() { int n; scanf("%d",&n); if(n%4==0 && n%100!=0 || n%400==0) printf("yes"); else printf("no"); return 0;}

2018-03-22 00:54:54 185

原创 BASIC-2 01字串

#include <cstdio>int change(int x) { //转为二进制 int cnt = 0; char number[10]; do { number[cnt++] = x % 2 + '0'; x /= 2; } while(x != 0); for(int i=5-cnt-1; i&...

2018-03-22 00:50:36 131

原创 BASIC-3 字母图形

#include <cstdio>int G[30][30];int main() { int n, m; scanf("%d%d",&n,&m); for(int i=0; i<26; i++) { int cnt = 0; for(int j=i; j<26; j++) { ...

2018-03-22 00:50:33 142

原创 BASIC-4 数列特征

#include <cstdio>typedef long long ll;const int MAXN = 10010;ll n, maxV = -1000000, minV = 1000000, sum = 0, number[MAXN];int main() { scanf("%lld",&n); for(ll i=0; i<n; i++...

2018-03-22 00:50:24 215

原创 BASIC-6 杨辉三角

#include <cstdio>const int MAXN = 110;int n, number[MAXN][MAXN];int main() { scanf("%d",&n); for(int i=0; i<n; i++) number[i][0] = number[i][i] = 1; for(int i=2; ...

2018-03-22 00:50:21 126

原创 BASIC-5 查找整数

#include <cstdio>typedef long long ll;const int MAXN = 110;ll n, x, number[MAXN];int main() { scanf("%lld",&n); for(ll i=0; i<n; i++) scanf("%lld",&number[i]); ...

2018-03-22 00:50:17 161

原创 BASIC-7 特殊的数字

#include <cstdio>void solve() { for(int i=1; i<10; i++) { for(int j=0; j<10; j++) { for(int k=0; k<10; k++) { int x =i*100 + j*10 + k; ...

2018-03-22 00:50:12 207

原创 BASIC-8 回文数

#include <cstdio>void solve() { for(int i=1; i<10; i++) { for(int j=0; j<10; j++) { int x = i*1000 + j*100 + j*10 + i; printf("%d\n",x); } ...

2018-03-21 22:57:42 167

原创 BASIC-9 特殊回文数

#include <cstdio>int n;void solve1() { //五位 for(int i=1; i<10; i++) { for(int j=0; j<10; j++) { int k = n - i*2 - j*2; if(0 <= k && k &l...

2018-03-21 22:53:48 199

原创 BASIC-10 十进制转十六进制

#include <cstdio>#include <cstring>using namespace std;typedef long long ll;int main() { char change[20] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; l...

2018-03-21 22:06:35 262

原创 BASIC-11 十六进制转十进制

#include <cstdio>#include <cstring>using namespace std;typedef long long ll;int main() { char str[110]; gets(str); ll len = strlen(str); ll x = 0; for(int i=0; i&l...

2018-03-21 21:56:02 159

原创 BASIC-12 十六进制转八进制

#include <cstdio>#include <cstring>using namespace std;typedef long long ll;const int MAXN = 110;int n, numberRadix8[MAXN], cnt;char number[MAXN];void change() { //16进制转10进制 ...

2018-03-21 17:55:38 218

原创 BASIC-13 数列排序

#include <cstdio>#include <algorithm>using namespace std;const int MAXN = 100010;int main() { int n, number[MAXN]; scanf("%d",&n); for(int i=0; i<n; i++) { ...

2018-03-21 16:59:57 133

原创 BEGIN-1 A+B问题

#include <cstdio>#include <cmath>using namespace std;typedef long long ll;int main() { ll a, b; scanf("%lld%lld",&a,&b); ll x = a + b; printf("%lld",x); r...

2018-03-21 16:55:44 131

空空如也

空空如也

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

TA关注的人

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