摘要:#include"iostream"#include"string"#include"map"using namespace std;map mp;int main(){ int t; cin>>t; int test=0; while(++test>l; ...
阅读全文
摘要:OJ上的一些水题(可用来练手和增加自信)(poj1003,poj1004,poj1005,poj1207,poj3299,poj2159,poj2739,poj1083,poj2262,poj3006,poj2255,poj3094)初级:一.基本算法:(1)枚举. (poj1018,poj1753...
阅读全文
摘要:#include"cstdio"#include"queue"#include"cstring"using namespace std;const int MAXN=10000;typedef pair P;int vis[MAXN];int s,e;bool prime(int x){ fo...
阅读全文
摘要:dfs总结:①从确定的一组数中选若干个符合条件的数(选OR不选 均试一试) 例题:lanqiao李白打酒、vj简搜一棋盘问题②将确定的一组数生成全排列(+剪枝),求符合条件的全排列 例:hdu素数环、lanqiao带分数③从二维数组中找到符合条件的路径 例:poj滑雪、lanqiao剪格子适...
阅读全文
摘要:DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 a...
阅读全文
摘要:DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on...
阅读全文
摘要:DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled...
阅读全文
摘要:问题描述:Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k...
阅读全文
摘要:#include"cstdio"#include"queue"#include"cstring"using namespace std;const int MAXN=205;typedef pair P;int N,A,B;int K[MAXN];int vis[MAXN];int bfs(){ ...
阅读全文
摘要:#include"cstdio"#include"algorithm"using namespace std;const int MAXN=4005;int A[MAXN],B[MAXN],C[MAXN],D[MAXN];int CD[MAXN*MAXN];int n;int main(){ ...
阅读全文
摘要:1、问题描述:悠悠假期同叔叔一起去书店,他选中了六本书,每本书的单价(单位:元)分别为:3.1,1.7,2,5.3,0.9 和7.2。不巧的是,叔叔只带了十几块钱,为了让悠悠高兴,叔叔同意买书,但提出了一个要求,要悠悠从六本书中选出若干本,使得单价相加所得的和同10 最接近。请编程帮助悠悠解决这个问...
阅读全文
摘要:经典记忆化搜索题目。当 从每个点一次进行搜索时要采用 记忆化搜索#include"cstdio"#include"algorithm"using namespace std;const int MAXN=105;int g[MAXN][MAXN];int t[MAXN][MAXN];int maxn...
阅读全文
摘要:Find them, Catch them Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 39402 Accepted: 12101 Description The police office in Tadu City deci
阅读全文
摘要:A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 89818 Accepted: 27967 Case Time Limit: 2000MS Description Y
阅读全文
摘要:问题描述 n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。 每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。 如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他交换,则他的不高兴程度增加2(即不高兴程度
阅读全文
摘要:资源视图--Dialog--右键--添加资源--新建--对话框--然后在已经生成的对话框中(解决资源视图中的dialog下的新生成的那个)右键--添加类。例如:添加CMyNewDlg类,在所要调的代码中(按钮点击方法按钮点击方法所在的文件代码),先加头文件#include "CMyNewDlg.h ...
阅读全文
摘要:命令窗口:调试->属性->把字符集设置为:未设置
阅读全文
摘要:A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 85502 Accepted: 26556 Case Time Limit: 2000MS Description Y
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 64784Accepted Submission(s): 27303Problem Desc...
阅读全文
摘要:赤裸裸的线段树#include#include#include#define Max(a,b) (a>b)?a:busing namespace std;const int MAX_N=100005*4;//至少要开2*n-1个空间typedef long long LL;struct node{ ...
阅读全文
摘要:用bfs进行深搜,求出每个可达点的最小转弯数#include#include#includeusing namespace std;const int MAX_N=105;char g[MAX_N][MAX_N];int vis[MAX_N][MAX_N];int n,m;int k,sx,sy,e...
阅读全文
摘要:题目描述:输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另一个单词。在判断是否满足条件时,字母不区分大小写,但在输出时应保留输入中的大小写,按字典序进行排列(所有大写字母在所有的小写字母的前面)。#include#include#include#include#i...
阅读全文
摘要:#include#include#include#include#includeusing namespace std;set dict;int main(){ string s,buf; while(getline(cin,s)) { dict.clear(); ...
阅读全文
摘要:#include#includeusing namespace std;typedef long long LL;typedef pair P;struct node{ int x,y; node(){} node(int cx,int cy):x(cx),y(cy){} f...
阅读全文
摘要:#include#include#includeusing namespace std;int main(){ int i=100000000; clock_t start,finish; double duration; start=clock();//开始计时刻 ...
阅读全文