404. Sum of Left Leaves Find the sum of all left leaves in a given binary tree. Example: ...
分类:
其他好文 时间:
2017-03-24 00:17:33
阅读次数:
157
#include<queue>#include<cstdio>#include<cstdlib>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int n,a;priority_queue<doubl ...
分类:
其他好文 时间:
2017-03-24 00:11:28
阅读次数:
156
算法提高 交换Easy 时间限制:1.0s 内存限制:512.0MB 时间限制:1.0s 内存限制:512.0MB 问题描述 给定N个整数组成的序列,每次交换当前第x个与第y个整数,要求输出最终的序列。 输入格式 第一行为序列的大小N(1<=N<=1000)和操作个数M(1<=M<=1000)。 第 ...
分类:
编程语言 时间:
2017-03-23 23:32:33
阅读次数:
255
题目链接:HDU-5129 题目大意为给一堆字符串,问由任意两个字符串的前缀子串(注意断句)能组成多少种不同的字符串。 思路是先用总方案数减去重复的方案数。 考虑对于一个字符串S,如图,假设S1,S2,S3,S4,S5,S6均为前缀。 换言之,对于这种字符串,我们计算了三次。 发现,重复的方案数,等 ...
分类:
其他好文 时间:
2017-03-23 22:24:49
阅读次数:
215
#include using namespace std; void init_pass_table(char (&code_table)[27][27]){//制密码对照表;(不能当做一维数组来看会有别的问题) code_table[0][0]='0'; for(int i=0;i25){ cod... ...
分类:
编程语言 时间:
2017-03-23 22:15:44
阅读次数:
429
package lianxidemo; //可变参数作用:让代码更简洁。最多只能有一个可变参数,放最后面。 public class KeBianCanShu { static int add(int...is){ int sum=0; for(int i:is) sum+=i; return su... ...
分类:
其他好文 时间:
2017-03-23 22:12:18
阅读次数:
134
1 /* 2 POJ1061 青蛙的约会 3 http://poj.org/problem?id=1061 4 扩展欧几里得 5 6 原题为求t使得,存在l满足 7 (x+mt)-(y+nt)=cl 8 即求 9 cl+(n-m)t=x-y 10 * 11 * 12 * 13 */ 14 15 #i... ...
分类:
其他好文 时间:
2017-03-23 21:57:14
阅读次数:
198
#include<iostream>#include<cstdio>using namespace std;int main(){ int i=2,n; scanf("%d",&n); printf("%d=",n); if(n<=3){ printf("%d",n); return 0; } wh ...
分类:
其他好文 时间:
2017-03-23 21:51:29
阅读次数:
186
Description The method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string (defaul ...
分类:
编程语言 时间:
2017-03-23 21:33:32
阅读次数:
194
Description 给定一张N个顶点M条边的无向图(顶点编号为1,2,…,n),每条边上带有权值。所有权值都可以分解成2^a*3^b的形式。现在有q个询问,每次询问给定四个参数u、v、a和b,请你求出是否存在一条顶点u到v之间的路径,使得路径依次经过的边上的权值的最小公倍数为2^a*3^b。注意 ...
分类:
其他好文 时间:
2017-03-23 21:20:27
阅读次数:
301