/*BFS,注意马脚!马脚WA了一次,后来WA了N次,最后发现输入时候将军和马的位置搞反,更改后AC*/1 #include 2 #include 3 #include 5 using namespace std; 6 const int maxn=10000,maxm=25; 7 int vis....
分类:
其他好文 时间:
2014-07-18 09:29:15
阅读次数:
302
BFS结合队列#include#include#includeusing namespace std;int x,y,l;const int maxn=300+5;int visit[maxn][maxn];struct node{ int xpos; int ypos; int ...
分类:
其他好文 时间:
2014-07-18 00:11:24
阅读次数:
245
时间限制:0.25s空间限制:4M题意 你的任务是找到最小自然数 N, 使N!在十进制下包含 Q个零. 众所周知 N! = 1*2*...*N. 例如, 5! = 120, 120 结尾包含1个零.Input 一个数 Q (0using namespace std;int check ...
分类:
其他好文 时间:
2014-07-18 00:10:28
阅读次数:
263
1. fstream 继承自iostream --> 要包含头文件#include2. 建立文件流对象3. 打开文件夹4. 测试是否打开成功5. 进行读写操作6. 关闭文件#include#includeusing namespace std;int main(){ ifstream ifil...
分类:
编程语言 时间:
2014-07-17 22:38:12
阅读次数:
283
模拟吧,算是。。。被这个题wa到哭,真是什么都不想说了。。。上代码 1 #include 2 #include 3 using namespace std; 4 5 struct node { 6 int x,y; 7 char c; 8 }q[10]; 9 ...
分类:
其他好文 时间:
2014-07-17 22:21:32
阅读次数:
458
#include "stdafx.h"#include #include using namespace std;DWORD WINAPI ThreadFuncFirst(LPVOID param){int iCount = 50;while(iCount--){cout<<"\nThreadFun...
分类:
编程语言 时间:
2014-07-17 21:29:18
阅读次数:
209
比基础的并查集有些进步。
在下面这个链接中有详细解释:
http://blog.csdn.net/ditian1027/article/details/20804911
对于每两个动物的关系,都是先推与最终的关系,在逆推与另一个的关系;
num中存的都是与最终节点的关系;
#include
#include
#include
using namespace std;
const in...
分类:
其他好文 时间:
2014-07-17 21:11:59
阅读次数:
216
题意:有n种面值的硬币a[i],每种硬币有c[i]个,问能组成不大于m面值(1~m)的个数。
多重背包模板:by背包九讲。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#d...
分类:
其他好文 时间:
2014-07-17 20:16:48
阅读次数:
233
题解:从1开始乘到n,因为结果只要最后一位,所以每乘完一次,只要保留后5位(少了值会不准确,刚开始只保留了一位,结果到15就错了,保留多了int会溢出,比如3125就会出错) 和下一个数相乘,接着保留5位,注意5位没有后导零,最后取5位中最后一个不是零的就可以了。
#include
#include
using namespace std;
int main() {
int n;
...
分类:
其他好文 时间:
2014-07-17 19:14:19
阅读次数:
181
简单搜索
直接代码:
#include
#include
#include
#include
using namespace std;
char a,c;
int e,f;
int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
int qq[9][9];
struct node
{...
分类:
其他好文 时间:
2014-07-17 19:05:30
阅读次数:
265