- 博客(18)
- 资源 (4)
- 问答 (1)
- 收藏
- 关注
原创 nyoj-214 单调递增子序列(二)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=214用之前的方法会超时,看了网上的大神的做法,要用到二分法,二分插入法代码:#include#include#define min -999999int stack[120000];int main(){ int top,num,i,low,high,mid,n,m;
2014-12-21 11:58:08
749
原创 nyoj-49 开心的小明
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=49代码:#include#include#define max(a,b) a>b?a:bint main(){ int du[230],value[230],dp[120200]; int total,num; int i,j,k,t,n; scanf("%d",&n)
2014-12-21 09:37:17
676
原创 hdu-1513 Palindrome vs nyoj-37 回文字符串
题目链接:hdu 1513:http://acm.hdu.edu.cn/showproblem.php?pid=1513nyoj 37:http://acm.nyist.net/JudgeOnline/problem.php?pid=37两者几乎相同,核心代码相同,只是范围不相同,前者多用了一个滚动数组,都用到了求最长公共子序列。hdu 1513:代码:#include
2014-12-20 20:32:26
606
原创 nyoj-171 聪明的kk
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171动态规划代码:#include#include#includeusing namespace std;int main(){ int dp[30][30]; int n,m,i,j,k,t; while(~scanf("%d%d",&n,&m)){ memse
2014-12-18 22:19:07
559
原创 nyoj-17 单调递增最长子序列
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=17跟做的上一道题目几乎一样,关键地方的代码改一下就行了代码:#include#include#includeusing namespace std;char str[10010];int dp[10010];int main(){ int n; int i,j,k,t;
2014-12-18 21:51:00
568
原创 nyoj-79 拦截导弹
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=79代码:#include#includeint main(){ int dp[30],num[30]; int ans,temp,i,j,k,t,n,m; scanf("%d",&n); while(n--){ scanf("%d",&m); memset
2014-12-18 21:21:42
573
原创 nyoj-76 超级台阶
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=76斐波那数列代码:#include#includeint main(){ int num[45]; int n,m; int i,j,k,t; memset(num,0,sizeof(num)); num[1]=1; num[2]=1; for(i=3;i<41;i+
2014-12-17 21:19:47
593
原创 nyoj-456 邮票分你一半
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=4560-1背包问题,现在发现我对0-1背包问题有点理解了我的代码:#include#include#includeusing namespace std;int main(){ int n,m; int dp[100010]; int num[100010]; int
2014-12-16 23:22:09
760
原创 nyoj-289 苹果
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=2890-1背包水过~~我的代码:#include#include#includeusing namespace std;int main(){ int dp[1200]; int i,j,k,t; int n,v,a,b; while(~scanf("%d%d",&n,
2014-12-16 18:59:09
552
原创 nyoj-325 zb的生日
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=325本道题目使用的是0-1背包,不过貌似用0-1背包效果不怎么好,参考别人的代码险过~我的代码:#include#include#includeusing namespace std;//int max(int a,int b){// return a>b?a:b;//}
2014-12-16 18:56:13
643
原创 nyoj-269 VF
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=269其实使用0-1背包不怎么熟练,看完这个讲解后才算是对这道题目理解了:http://blog.csdn.net/u013050857/article/details/38373119我的代码:】#include#includeint main(){ int dp[10][8
2014-12-16 18:50:46
657
原创 nyoj-252 01串
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=252简单水题代码:#include#includeint main(){ int n,t; int num[120]; memset(num,0,sizeof(num)); num[2]=3; num[3]=5; for(int i=4;i<110;i++) n
2014-12-16 18:48:51
597
原创 nyoj-nyoj An problem about date 吉姆拉森公式
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=219#include#include int main(){ int year,month,day; while(~scanf("%d %d %d",&year,&month,&day)) { if(month>=1&&month<=2){ month+=12;
2014-12-14 22:39:23
903
原创 hdu-1874 畅通工程续 最短路径问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874弗洛伊德最短路径问题代码:#include#include#define inf 0x3f3f3f3f#includeusing namespace std;int map[300][1010];int main(){ int i,j,k,t; int n,m,a,
2014-12-13 22:28:03
611
原创 nyoj-27 水池数目
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=27代码:#include#include#includeint num[120][120];int top[4][2]={{1,0},{-1,0},{0,1},{0,-1}};int a,b,ans;void dfs(int x,int y){ num[x][y]=0;
2014-12-12 19:00:35
570
原创 hdu 2209 翻纸牌游戏
题目链接:搜索题,有两种情况,两种有一种不考虑的话就会WA....代码:#include#include#define INF 999999999//定义一个最大的数 #includeusing namespace std;int num;int shu1[30];char str[30];int ans,m;int dfs(int n,int num,int m){ if
2014-12-09 21:09:13
619
原创 hdu 1015 Safecracker 搜索
http://acm.hdu.edu.cn/showproblem.php?pid=1015#include#include#includeusing namespace std;char zifu[2000],str[20],str1[20];int mark[1000],k,num,flag;int cmp(const void *a,const void *b){ retur
2014-12-08 22:47:48
492
原创 poj 1338 Ugly Numbers
题目链接:http://poj.org/problem?id=1338丑数#include#includeint main(){ int i,j,k,t; int num[1510]; memset(num,0,sizeof(num)); int q2,q3,q5; int t2,t3,t5; q2=q3=q5=num[1]=1; for(i=2;i<=1501;i++){
2014-12-04 13:16:41
477
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人