上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页
  2014年4月30日
摘要: 使用C/C++处理大数据时有时不是很方便,这时可以使用JAVA中大数类,当然代价就是运行时慢。import java.math.*;import java.util.*;import java.io.*;import java.text.*;public class test{ public ... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题意:平面上给你n个点。1为起始点,问你从1号点出发经过其他所有点再回到1号点的最短距离,两点之间的距离是曼哈顿距离(abs(x1-x2)+abs(y1-y2))。思路:DFS,算出每次的距离,取最短即可。#include#include#include#include#include#define... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 对于每头牛可以取或者不取,因此两种方法:dfs或二进制枚举,不过二进制枚举比较慢,但一般来说都能在题目限定时间内出解。1.DFS(32ms):#include#include#include#include#include#define INF 0x7fffffffusing namespace s... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 水题:直接模拟即可,次数cnt = abs(cnt1-cnt2)/2;#include#include#include#include#includeusing namespace std;int main(){ string s; int n, ans; while(~scanf... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(125) 评论(0) 推荐(0) 编辑
摘要: C. Magic Formulastime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPeople in the Tomskaya region l... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9899Accepted Submission(s): 4518Pr... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(79) 评论(0) 推荐(0) 编辑
摘要: Til the Cows Come HomeTime Limit:1000MSMemory Limit:65536KTotal Submissions:27591Accepted:9303DescriptionBessie is out in the field and wants to get b... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 思路:二进制枚举,再用位运算来判断选的那些行是否满足每列只有一个1,(很神奇的位运算)。考虑最多16行,因此可以用一个int型(32位>16)的每个二进制位来表示每列状态,比如某列的第二行有个1,则int型数字里面第二个二进制位就为1,时间复杂度2^16*m,可以接受。这里存在一个问题就是怎么通过每... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 利用深度优先搜索的性质可以方便的生成n的排列和组合。生成排列(默认是全排列,也可以传个参数生成n的k排列)#include#define MAXN 111using namespace std;int tmp[MAXN],vis[MAXN],n,k;void dfs(int cnt,int num ... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 1.DFS:#include#include#include#include#include#include#includeusing namespace std; char str[20], ans[10]; int vis[20], flag; bool cmp(char a, char b){... 阅读全文
posted @ 2014-04-30 18:39 wangzhili 阅读(141) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页