//回溯法解决数字拆解的问题
#include<iostream>
usingnamespacestd;
constintN=6;
voidOutPut(int*a,intN)
{
for(inti=N-1;i>0;i--)
{
for(intj=0;j<a[i];j++)
cout<<i<<"";
}
cout<<endl;
}
voidSolve(int*a,intt,intsum)
{
if(sum==0)
OutPu..
分类:
其他好文 时间:
2015-03-17 14:28:09
阅读次数:
107
#include?<iostream>
#include?"stdio.h"
#include?"stdlib.h"
#include?"memory.h"
using?namespace?std;
/*
用math.h的pow函数?测评系统会编译错误,所以自己写个pow函数
*/
//题目要求最大8位,所以可...
分类:
其他好文 时间:
2015-03-15 15:24:02
阅读次数:
135
#include?<iostream>
#include?"stdio.h"
#include?"stdlib.h"
#include?"memory.h"
using?namespace?std;
int?main(int?argc,?char?*argv[])
{
unsigned?int?num?;
cin?>>?num;
int?tmp[999...
分类:
其他好文 时间:
2015-03-15 14:01:46
阅读次数:
151
分析: ????很简单,就是输出0~32 的二进制形式 ? 32中可能 就是最多5位数 00000 00001 00010........ 输出即可 #include?<iostream>
#include?"stdio.h"
#include?"stdlib.h"
using?namespace?std;
i...
分类:
其他好文 时间:
2015-03-14 20:16:01
阅读次数:
119
上千万或上亿的数据,现在的机器的内存应该能存下。所以考虑采用hash_map/搜索二叉树/红黑树等来进行统计次数。然后就是取出前N个出现次数最多的数据了,可以用第2题提到的堆机制完成。
#include "IOSTREAM"
#include
#include
#include
using namespace std;
int main(void)
{
//海量待统计数据
char...
分类:
编程语言 时间:
2015-03-14 08:29:20
阅读次数:
412
Kruskal#include "iostream"#include "algorithm"using namespace std;#define MAXN 1111struct node { int x, y, l;}p[MAXN];int fa[MAXN];int n, m, k;int ...
分类:
其他好文 时间:
2015-03-13 20:36:45
阅读次数:
119
//Problem tags 上竟然有人贴 data structures...保存最大的两个 h[i] 不就好了么...... 1 #include "iostream" 2 #include "cstdio" 3 using namespace std; 4 int n, w[200010], ...
分类:
其他好文 时间:
2015-03-12 22:16:10
阅读次数:
112
#include"iostream"#include"stdio.h"#include"algorithm"#include"string.h"#include"queue"#include"cmath"int homework[10005][105];int n,l,m;int count[100...
分类:
其他好文 时间:
2015-03-12 22:10:58
阅读次数:
136
1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 #include "map" 6 using namespace std; 7 int n; 8 map dp; 9 vo....
分类:
其他好文 时间:
2015-03-12 20:49:38
阅读次数:
128
被这道题坑到了,如果单纯的模拟题目所给的步骤,就会出现同一个位置要走两次的情况。。。所以对于bfs来说会很头痛。第一个代码是wa掉的代码,经过调试才知道这个wa的有点惨,因为前面的操作有可能会阻止后面的正确操作:#include"iostream"#include"stdio.h"#include"...
分类:
其他好文 时间:
2015-03-12 20:37:32
阅读次数:
180