添加链接描述 二叉树的前序、中序、后序遍历的定义: 前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树; 中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右子树;...
添加链接描述 二叉树的前序、中序、后序遍历的定义: 前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树; 中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右子树;...
题目链接 解题思路: 1、将a进制数转换成十进制数; 2、将十进制数转换成b进制数; 3、使用do while 循环,可以确保即使被转换数字是 0 ,程序也能正常工作。 AC代码: #include<iostream>...
//得使用.cpp,不然那没法编译通过//会出现fatal error C1003: 错误计数超过 100;正在停止编译//注意括号匹配问题,具体语句应该在哪个大括号中。#include&lt;stdio.h&gt;#include&...
#define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> #include <algorithm> using namespace std; struct TVprogram { int start; int end; bool operator <(TVprogram b) const { ...
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&amp;pid=86 C语言源码: #include&lt;stdio.h&gt; #define maxsize 10000000 int queue[10000000][3];... int s,n,m,i,j,k,...
#include&lt;stdio.h&gt; int main(){ // printf("1089*9=%d\n",1089*9); for(int i=0;i&lt;10;++i){ for(int j=0;j&lt;10;++j){ if((1000+i*100+j*10+9)*9==9000+j*100+i*10+1)......
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&amp;pid=99 C语言源码: #include&lt;stdio.h&gt; #include&lt;limits.h&gt; #define maxsize 4010 ...int max2(int a,int...
题目地址:http://ac.jobdu.com/problem.php?cid=1040&amp;pid=34 C语言源码: #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&... struct BiTree *lchild,*...
题目地址:http://ac.jobdu.com/problem.php?cid=1040&amp;pid=29 C语言源码: #include&lt;stdio.h&gt; #include&lt;limits.h&gt; typedef struct Huffmantree ...int de...
//方法一:需要预处理 #include #include using namespace std; #define ISYEAP(x) x%100!=0 && x%4==0||x%400==0 ?1:0 int dayofMonth[13][2]={0,0,31,31,28,29,31,31,30,30,31,31,30,30,31,31,31,31,30,30,31,31...
题目地址:http://ac.jobdu.com/problem.php?cid=1040&amp;pid=50 C语言源码: #include&lt;stdio.h&gt; int main() { int a[10001],n,i,j,b[1000],top; while(scanf("...i...
题目地址:http://ac.jobdu.com/problem.php?cid=1040&amp;pid=3 C语言源码: #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&... int ...
题目地址:http://ac.jobdu.com/problem.php?cid=1040&amp;pid=22 C语言源码: #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; int cmp(const void *a,const void *b) ...int main...
题目描述: 读入两个小于10000的正整数A和B,计算A+B。需要注意的是:如果A和B的末尾K(不超过8)位数字相同,请直接输出-1。 ...测试输入包含若干测试用例,每个测试用例占一行,格式为"A B K",相邻两数字有一...
题目描述: The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle ...
九度教程第二十二题 #include #include using namespace std; struct program { int startTime;//节目开始时间 int endTime;//节目结束时间 bool operator (const program &A)const { return endTime ; }...
//1185:特殊排序 #include #include using namespace std; int main() { int N; int n[1010]; int m[1010]; while(cin>>N) { int num=0; for(int i=0;i { cin>>n[i]; } int max=n[0];...{
标签: 计算机
题目1040:Prime Number 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8166 解决:3245 题目描述: Output the k-th prime number. 输入: k≤10000 输出: The k-th prime number. ...7
九度教程第一题 源代码 #include int main() { int n; int buf[100]; while(~scanf("%d",&n)) { for(int i = 0;i ;i ++) scanf("%d",&buf[i]); for(int i = 0;i ;i ++) for(int j = 0;j ...
题目描述: 实现一个加法器,使其能够输出a+b的值。 输入: 输入包括两个数a和b,其中a和b的位数不超过1000位。 输出: 可能有多组测试数据,对于每组数据, 输出a+b的值。...1000
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=102 C语言源码: #include #define maxsize 2010 int dp[maxsize]; typedef struct ri { int price; int weight;...int max(int a,int
题目地址:... C语言源码: #include #include #include #define maxsize 600 double lengthcmax,pricemin,falg; double cmax,length,davg;...typedef struct statio
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=69 C语言源码: #include #include #include #include #define maxsize 2000 int e[maxsize][maxsize];...char name[maxsize][5];...typede
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&amp;pid=101 C语言源码: #include&lt;stdio.h&gt; #include&lt;limits.h&gt; #define maxsize 10005 ... int...
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=100 提供组数据: input: 105 10 12 11 16 16 24 15 7 9 29 24 32 25 5 3 43 32 31 41 1 7 output: 112 C语言源码: ...ty
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&amp;pid=97 C语言源码: #include&lt;stdio.h&gt; #include&lt;string.h&gt; int dp[110][110]; char s1[110],s2[110];... ...
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=96 C语言源码: #include int max1[101],max2[101]; int main() { int i,j,n,num,a[101];... while(scanf("%d",&n)!... scanf("%d
题目地址:http://jobdu.sinaapp.com/problem.php?cid=1040&pid=95 C语言源码: #include int max[26]; int main() { int i,j,n,a[26],ans; while(scanf("%d",&n)!=EOF) { for(i=1;i;... m