• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
frankM
天下武功,唯快不破。
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

05 2014 档案

 
01背包 (大数据)
摘要:经典的01背包问题,如果把限制条件改为:重量#include#define INF 10000000using namespace std;int c[105],v[105];int dp[10005]; //dp[i],表示在价值i下的最小重量int main(){ ... 阅读全文
posted @ 2014-05-31 12:29 frankM 阅读(624) 评论(0) 推荐(0)
NYOJ 311 完全背包
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=311这道题是完全背包的一个变型,,:求的是把背包装满的最优解.dp方程跟经典的一样:for(i=0; idp[j]) dp[j]=dp[j-c[i]]+w[i]; ... 阅读全文
posted @ 2014-05-30 20:16 frankM 阅读(116) 评论(0) 推荐(0)
NYOJ 58 最少步数
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=58经典的迷宫问题,,,,用BFS穷举:#include #include#include#include#define N 9using namespace std;const int INF=... 阅读全文
posted @ 2014-05-29 15:06 frankM 阅读(120) 评论(0) 推荐(0)
POJ 2386 Lake Counting
摘要:链接:http://poj.org/problem?id=2386DFS 的入门级题目....依次递归8个方向即可:#include //#includeusing namespace std;char data[105][105];int n,m;void dfs(int x,int y){ ... 阅读全文
posted @ 2014-05-28 13:23 frankM 阅读(92) 评论(0) 推荐(0)
第七届河南省ACM A题
摘要:#include #includeusing namespace std;int data[105];int n,m;int ans;void dfs(int i,int sum){ if(sum==m) { ans++; return ; } i... 阅读全文
posted @ 2014-05-27 21:49 frankM 阅读(151) 评论(0) 推荐(0)
NYOJ 16 矩形嵌套
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=16最长单调子序列......注意可以不是连续的#include //#include#include#define max( a, b ) ((a>b)?(a):(b))using namesp... 阅读全文
posted @ 2014-05-27 17:26 frankM 阅读(117) 评论(0) 推荐(0)
NYOJ 370 波动序列
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=370#include #includeusing namespace std;int main(){ int t; int n; int i; int a; int... 阅读全文
posted @ 2014-05-23 21:48 frankM 阅读(169) 评论(0) 推荐(0)
NYOJ 168 房间安排
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168模拟即可:#include using namespace std;int sign[200];int main(){ int t; int n; int i; in... 阅读全文
posted @ 2014-05-22 22:43 frankM 阅读(144) 评论(0) 推荐(0)
NYOJ 113 字符串替换
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=113直接用string类里的fin()和replace()成员函数即可#include #includeusing namespace std;int main(){ string dat... 阅读全文
posted @ 2014-05-22 17:28 frankM 阅读(127) 评论(0) 推荐(0)
NYOJ 4 ASCII码排序
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=4水题#include #includeusing namespace std;int main(){ int n; cin>>n; char data[5]; while... 阅读全文
posted @ 2014-05-22 13:25 frankM 阅读(97) 评论(0) 推荐(0)
code::blocks基本使用方法
摘要:第一,,,一定要到官网上下,,别的地方下载的都是不自带编译器的,,或者,你的电脑里已经有VS或者别的,设置下就可以,,后面会说怎么设置..这个是官网:http://www.codeblocks.org/ 进去后点download 进入到这个页面 然后,,等3s就开始下载了..~~~~安装就不用说了,... 阅读全文
posted @ 2014-05-21 18:51 frankM 阅读(278) 评论(0) 推荐(0)
NYOJ 759 你知道这个规律吗?
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=759找了半天没找到什么规律....直接按大数除法做了 #include #include using namespace std;char num[100005];int main(){ int... 阅读全文
posted @ 2014-05-21 18:26 frankM 阅读(86) 评论(0) 推荐(0)
HDU 1321 Reverse Text
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1321水题....记得要吃换行符#include#include int main(){ char data[100]; int t; scanf("%d",&t); getchar(); while(t--... 阅读全文
posted @ 2014-05-21 14:44 frankM 阅读(117) 评论(0) 推荐(0)
HDU 1234 开门人和关门人
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1234直接用strcmp()比较时间即可#include #include int main(){ bool judge(char t1[],char t2[]); char id[20]; char t1[... 阅读全文
posted @ 2014-05-20 20:22 frankM 阅读(169) 评论(0) 推荐(0)
NYOJ 912 领帽子
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=912全错位排列,按照欧拉给出的递推公式:f(n)=(n-1) {f(n-1)+f(n-2)}#include using namespace std;int main(){ long long ... 阅读全文
posted @ 2014-05-20 19:26 frankM 阅读(79) 评论(0) 推荐(0)
NYOJ 495 少年 DXH
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=495直接暴力#include #include char s[100];int main(){ bool isplalindrome(int l); int t; int l; int i,j;... 阅读全文
posted @ 2014-05-19 23:05 frankM 阅读(166) 评论(0) 推荐(0)
NYOJ 95 众数问题
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=95理解题意后就很简单了..数组标记法#include using namespace std;int sign[100000];int main(){ int n; int m; cin>>n;... 阅读全文
posted @ 2014-05-18 22:26 frankM 阅读(127) 评论(0) 推荐(0)
POJ 3264 Balanced Lineup (RMQ分析)
摘要:链接:http://poj.org/problem?id=3264RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,jO(nlogn){ for(int j = 1; j #includeusing namespa... 阅读全文
posted @ 2014-05-18 15:51 frankM 阅读(137) 评论(0) 推荐(0)
HDU 1172 猜数字
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1172把1000~9999间的数字遍历一遍,如果只有一个符合条件的话,就输出,否则 not sure#include using namespace std;char data[105][5];int a[1... 阅读全文
posted @ 2014-05-18 13:12 frankM 阅读(152) 评论(0) 推荐(0)
HDU 2710 Max Factor
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=2710这道题有点问题,,,是多组数据,要用while(cin),,或者whlie(scanf("")!=EOF)另,要把1当成素数处理.......#include using namespace std;b... 阅读全文
posted @ 2014-05-16 13:29 frankM 阅读(126) 评论(0) 推荐(0)
HDU 3346 Lucky Number
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=3346少输出一个感叹号,,wa好几次......#include #include #include using namespace std;int main(){ char buf[100]; int t;... 阅读全文
posted @ 2014-05-15 22:07 frankM 阅读(111) 评论(0) 推荐(0)
NYOJ 127 星际之门(一)
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=127//cayley定理#include using namespace std;int main(){ int x,ans,i,m; scanf("%d",&x); while(x--) { ... 阅读全文
posted @ 2014-05-15 21:35 frankM 阅读(149) 评论(0) 推荐(0)
BNUOJ 1013 YC大牛的判题任务
摘要:链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=1013水题..用结构体二级排序即可..#include #include using namespace std;typedef struct{ int num; int time;}pro;pr... 阅读全文
posted @ 2014-05-14 17:12 frankM 阅读(181) 评论(0) 推荐(0)
BNUOJ 1011 人工智能?
摘要:链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=1011简单题,..字符串查找注意有有小数出现#include #include #include #include using namespace std;string data;int main... 阅读全文
posted @ 2014-05-14 16:25 frankM 阅读(175) 评论(0) 推荐(0)
HDU 1035 Robot Motion
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1035简单模拟题...但有几个细节需要注意:1>当输入为0 0 时程序会不会正常结束(如果scanf("%d%d%d",....)是不可以滴)2>走到边缘是不结束的,只要迈出去才算3>注意loop的步数,不要... 阅读全文
posted @ 2014-05-13 21:20 frankM 阅读(120) 评论(0) 推荐(0)
HDU 1214 圆桌会议
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1214把每个桌子分成两半,分开考虑。比如,圆桌7个人的话,就分成一个4人的,一个3人的单向序列...分别算出把每个序列反向排序需要的最少交换次数(6,3)。。两个的和即为结果9 ,,再求每个长度为 i 的单向... 阅读全文
posted @ 2014-05-12 22:05 frankM 阅读(99) 评论(0) 推荐(0)
NYOJ 86 找球号(一)
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=86用数组标记法爆内存,暴力搜索超时....有一种方法是 快排+二分查找.可以过,但是有点慢.. #include #include #include using namespace std;in... 阅读全文
posted @ 2014-05-12 18:24 frankM 阅读(118) 评论(0) 推荐(0)
HDU 2602 Bone Collector
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602简单01背包#include #define MAX( a, b ) ((a>b)?(a):(b)) using namespace std;typedef struct { int value; in... 阅读全文
posted @ 2014-05-11 16:47 frankM 阅读(102) 评论(0) 推荐(0)
HDU 1395 2^x mod n = 1
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1395欧拉定理 如果gcd(a,m)==1,a^(euler_phi(n))≡1(mod n)。euler_phi(n)为欧拉函数,其作用是返回与小于n且与n互质的数的个数...令m=euler_phi(n)... 阅读全文
posted @ 2014-05-11 10:33 frankM 阅读(126) 评论(0) 推荐(0)
HDU 1896 Stones
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=1896学了下优先队列:#include #include #define MAX(a,b) ((a) > (b) ? (a) : (b)) using namespace std;struct node{ i... 阅读全文
posted @ 2014-05-10 17:50 frankM 阅读(157) 评论(0) 推荐(0)
priority_queue的用法
摘要:priority_queue调用 STL里面的 make_heap(), pop_heap(), push_heap() 算法实现,也算是堆的另外一种形式。先写一个用 STL 里面堆算法实现的与真正的STL里面的 priority_queue用法相似的priority_queue, 以加深对 pri... 阅读全文
posted @ 2014-05-10 17:35 frankM 阅读(202) 评论(0) 推荐(0)
NYOJ 28 大数阶乘
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=28大数问题。模拟手工运算,用一个变量储存进位:被乘数逐位乘以乘数。#include #include #include int ans[20000];char tem[5];int t; ... 阅读全文
posted @ 2014-05-08 16:15 frankM 阅读(136) 评论(0) 推荐(0)
ZJU 1272 Numerically Speaking
摘要:大数问题......根据先余为低位,后余为高位的基本思想,进行26->10进制的互相转换。注意如果输入为的10进制数为26的整数时,要先减一再求余,最后结果在加a..因为目标进制没有表示0的数Presentation Error 了好几次。。要看到这句话“and the corresponding ... 阅读全文
posted @ 2014-05-05 21:34 frankM 阅读(169) 评论(0) 推荐(0)
NYOJ 625 笨蛋的难题(二)
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=625刚开始以为是博弈方面的问题,浪费了不少时间。这道题的解法有点像动态规划,同时也有点贪心的意思总体思想是倒推,分解成多个子问题,从后往前算...first记录从当前位置向后先取的最大值,las... 阅读全文
posted @ 2014-05-04 14:42 frankM 阅读(143) 评论(0) 推荐(0)
NYOJ 102 次方求模
摘要:链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=102用二分求幂:注意要用长整形 #include int main(){ long long power(int a,int b,long long c); int n; int a,b,c; ... 阅读全文
posted @ 2014-05-04 08:09 frankM 阅读(110) 评论(0) 推荐(0)
ZJU Least Common Multiple
摘要:#include#includeint *data;int main(){ void lcm(int n); int m; int n; int i; scanf("%d",&m); while(m--) { scanf("%d",&n); data=(int *)malloc(sizeo... 阅读全文
posted @ 2014-05-03 21:08 frankM 阅读(203) 评论(0) 推荐(0)
ZJUOJ 1073 Round and Round We Go
摘要:链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=73高精度乘法。一次乘以2~len,再判断是否是原字符串的一个cut-string 有一个函数叫strstr()..用上能精简很多代码。。#include#includecha... 阅读全文
posted @ 2014-05-01 16:28 frankM 阅读(149) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3