#include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> #include<cstring> using namespace std; int n, m; ][]; void calc() { ;i<n;i++) { ;j<m;j++) { if(x[i][j]=='*') { putchar('*…
#include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> using namespace std; /* * A solution for "The Trip" problem. * UVa ID: 10137 */ #include <stdio.h> int main (int argc…
, '\n'); #include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> #include<cstring> //uva 10033 Problem G: Interpreter #define ONLINE_JUDGE using namespace std; ]; ]; int steps; ; int…
/* Stern-Brocot代数系统 Stern-Brocot树是一种生成所有非负的最简分数m/n的美妙方式. 其基本方式是从(0/1, 1/0)这两个分数开始, 根据需要反复执行如下操作: 在相邻的分数 m/n 和 m1/n1之间插入 (m+m1)/(n+n1) 例如,可以将它看成是无限延伸的二叉树 0 1 1 --- --- --- 1 1 0 / \ / \ 1 2 --- --- 2 1 / \ / \ / \ / \ 1 2 3 3 --- --- --- --- 3 3 2 1 .…
#include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> #include<cstring> #include<set> using namespace std; int m; int n; //bmp[y][x] char bmp[251][251]; void swap_if_bigger(in…
#include <string> #include <iostream> #include <cstring> #include <algorithm> using namespace std; string numbers[5][10]={ " - ", "   ", " - ", " - ", "   ", " - ", "…
 The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is…
题意: 输入一颗二叉树,按照(左右左右, 节点的值)的格式.然后从上到下从左到右依次输出各个节点的值,如果一个节点没有赋值或者多次赋值,则输出“not complete” 一.指针方式实现二叉树 首先定义一个结构体,然后定义一个结构体指针root,作为整棵树的根节点.如果需要用到左右节点则申请一个空间,也就是用不到的就不申请,以节省空间. 遍历方式是广度优先遍历(BFS),从根节点依次拓展子节点,如果有子节点就入队,然后根节点出队.继续拓展,直到队列为空,即遍历完整棵树. 因为指针丢失以后会造成…
是否可以把树上结点的编号,然后把二叉树存储在数组中呢?很遗憾如果结点在一条链上,那将是2^256个结点 所以需要采用动态结构 首先要读取结点,建立二叉树addnode()+read_input()承担这样的工作 然后遍历二叉树,读取结点编号输出bfs() 这道题有内存池应用的背景 附链接  http://blog.csdn.net/shawngucas/article/details/6574863 #include <cstdio> #include <cstring> #inc…
题目描述: 每周一题之2  Mineweep(扫雷) Minesweeper (扫雷) PC/UVa IDs: 110102/10189, Popularity: A, Success rate: high Level: 1 测试地址:https://vjudge.net/problem/UVA-10189 [问题描述] Have you ever played Minesweeper? It’s a cute little game which comes within a certain O…