首页
学习
活动
专区
工具
TVP
发布

wym

专栏作者
404
文章
301807
阅读量
27
订阅数
输入广义表建立二叉树(层序输出)
#include <bits/stdc++.h> using namespace std; struct node{ char ch; node *lc,*rc; }; char s[100]; int flag=0; int n; int i=0; node * build_tree() { if(i>=n) return NULL; node *p = new node; p->lc = NULL; p->rc = NULL; p->ch = '0';//初始化 for(;i<n;
用户2965768
2018-12-18
1K0
中序遍历二叉树(栈思想)
完整代码如下,这是我在做了广义表建立二叉树后顺便写的中序遍历二叉树,所以输入是广义表
用户2965768
2018-12-18
5360
一元稀疏多项式计算 (数据结构实验)
#include <bits/stdc++.h> using namespace std; struct node{ float coef;//系数 int exp;//指数 node * next; }; node * creat(node * l) { float coef; int exp; l = new node; node * p,* q; scanf("%f %d",&coef,&exp); p=l; while(coef!=0||exp!=0) { p->co
用户2965768
2018-12-05
1.1K0
JAVA 栈的操作
 栈是一种后入先出的数据结构。有以下基本操作。 Stack stack = new Stack(); stack.push()  元素入栈 stack.pop() 栈顶元素出栈 stack.peek() 查看栈顶元素 stack.size() 查看栈的大小   stack.empty()判断栈是否为空,  true or false stack.serch(** ***)查找元素 ,返回int.  若找到返回位置,找不到返回-1     下面为了方便用了Enumeration类 package expres
用户2965768
2018-11-22
1K0
ACM / ICPC 2018亚洲区预选赛北京赛站网络赛 3题签到
选择一个城市开始,必须按照顺时针遍历完所有城市,第一次到这个城市获得ai经费,到下一个城市的代价是bi
用户2965768
2018-09-29
4380
opencv学习笔记 python实现 图像梯度与图像边缘
        图像梯度即求导数,导数能反映出图像变化最大的地方,图像变化最大的地方也就是图像的边缘。
用户2965768
2018-09-29
1.1K0
The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online(四题签到)
C题 用map超时,mmp map一直超时写了两个小时,单纯的数组就行 思路:有n条指令,值为r 存下执行第i条指令的时候的值r,若重复则输出“No” 否则“Yes”  //C #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <algorithm> using namespace std; typedef long long llong; const int MAXN = 10000
用户2965768
2018-09-29
5230
ACM-ICPC 2018 焦作赛区网络预赛 Give Candies
最后还要除以2,因为是n-1次方,乘以逆元,防止除2出现各种问题(2*逆元=1000000008)
用户2965768
2018-09-29
5540
2013年多校 hdu 4602
题目传送门 遇事不决先打表: 打表代码 #include <bits/stdc++.h> using namespace std; int num[1000]; deque<int> a,b; void dfs(int n,int _n) { if(n==0) { while(_n--) {int t=a.front(); num[t]++; a.pop_front(); a.push_back(t); } return ; } for(int i=1;i<=n;
用户2965768
2018-09-29
2670
2013年多校赛 hdu4607
   那么就考虑树上最长距离,树的直径, 如果访问的点大于树的直径就要走回头路,答案即多的数乘2加上原来树的直径
用户2965768
2018-09-29
2890
ACM-ICPC 2018 徐州赛区网络预赛F. Features Track
//滚动数组思想 #include <iostream> #include <queue> #include <algorithm> #include <map> struct NODE { int x,y; bool operator < (const NODE &b)const { if(x==b.x)return y<b.y; else return x<b.x; } }; using namespace std; int main() { int t; map<NOD
用户2965768
2018-09-29
4270
分解质因子
void getp(LL n) { //分解质因子 p = 0; for(int i = 2; i * i <= n; i++) { if(n % i == 0) { arr[p++] = i; while(n % i == 0) n /= i; } } if(n > 1) arr[p++] = n; }
用户2965768
2018-09-29
4150
Manthan, Codefest 18 (rated, Div. 1 + Div. 2)A B C
A #include <iostream> using namespace std; int cnt; void solve(int n) { cnt=0; while(n>=(1<<(cnt))) { cnt++; } } int main() { int n; cnt=0; scanf("%d",&n); solve(n); printf("%d\n",cnt); return 0; } B #include <iostream> #include <algorith
用户2965768
2018-09-29
3060
python实现 opencv 学习笔记 图像二值化
import cv2 as cv def threshold_image(image): gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY) cv.imshow("yuantu", gray) ret, binary = cv.threshold(gray, 0, 255, cv.THRESH_BINARY | cv.THRESH_OTSU) print(ret) cv.imshow("OTSU", binary) r
用户2965768
2018-09-29
1.2K0
python实现 opencv 学习笔记---模板匹配matchTemplate
这是打印出result的值,下面一张图是计算公式,通过公式也可以知道匹配程度在什么情况下最好
用户2965768
2018-09-29
2.6K0
opencv下imread函数返回值
openCV的imread()函数和imwrite()函数能支持各种静态图像文件格式。
用户2965768
2018-08-30
3.2K0
南昌大学航天杯第二届程序设计竞赛校赛网络同步赛 H小q的数列
while ((ch = getchar()) >= '0' && ch <= '9'){
用户2965768
2018-08-30
2520
Train Problem I HDU 1022
#include <queue> #include <cstring> #include <string> using namespace std; int book[200],in[200],out[200]; string ans[200]; int main() { int n,t; int flag=1; deque<int> q; while(cin>>n) {   t=0;  flag=1; memset(book,0,sizeof(book));  while(!q.empty())q.pop_back(); getchar(); for(int i=1;i<=n;i++) { char ch;  scanf("%c",&ch); in[i]=ch-'0'; } getchar(); for(int i=1;i<=n;i++) { char ch;  scanf("%c",&ch); out[i]=ch-'0'; } //for(int i=1;i<=n;i++)   //cout<<in[i]<<" "<<out[i]<<endl; for(int i=1;i<=n;i++)    { if(book[out[i]]&&q.back()==out[i]) {  q.pop_back();  ans[t++]="out";  continue; }else if(book[out[i]]) {      printf("No.\nFINISH\n");      flag=0;   break;        }        int j;       while(!book[out[i]])            {  for( j=1;j<=n;j++)                if(!book[in[j]])                    break; book[in[j]]=1; q.push_back(in[j]); ans[t++]="in"; } ans[t++]="out"; q.pop_back(); }   if(flag)  { printf("Yes.\n"); for(int i=0;i<t;i++)                    cout<<ans[i]<<"\n";                    printf("FINISH\n"); }  } return 0; }
用户2965768
2018-08-30
2220
hdu 1025 Constructing Roads In JGShining's Kingdom
JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines. Half of these cities are rich in resource (we call them rich cities) while the others are short of resource (we call them poor cities). Each poor city is short of exactly one kind of resource and also each rich city is rich in exactly one kind of resource. You may assume no two poor cities are short of one same kind of resource and no two rich cities are rich in one same kind of resource.  With the development of industry, poor cities wanna import resource from rich ones. The roads existed are so small that they're unable to ensure the heavy trucks, so new roads should be built. The poor cities strongly BS each other, so are the rich ones. Poor cities don't wanna build a road with other poor ones, and rich ones also can't abide sharing an end of road with other rich ones. Because of economic benefit, any rich city will be willing to export resource to any poor one. Rich citis marked from 1 to n are located in Line I and poor ones marked from 1 to n are located in Line II.  The location of Rich City 1 is on the left of all other cities, Rich City 2 is on the left of all other cities excluding Rich City 1, Rich City 3 is on the right of Rich City 1 and Rich City 2 but on the left of all other cities ... And so as the poor ones.  But as you know, two crossed roads may cause a lot of traffic accident so JGShining has established a law to forbid constructing crossed roads. For example, the roads in Figure I are forbidden.
用户2965768
2018-08-30
3800
hdu1026 Ignatius and the Princess I(bfs+路径)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 21262    Accepted Submission(s): 6890 Special Judge
用户2965768
2018-08-30
3590
点击加载更多
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档