摘要: 代码有点长,不过ACCEPT了创新点是输入时,用set数组来表示第t秒x个位置上下了一个饼看了人家给得特殊例子,发现一个问题,当第i秒没有饼下来,或者第i秒饼下的位置人没有走到,这两种特殊情况,所以就加了以下的几行代码if(set[i][j-1]!=0&&j-1>=0)dp[i][j-1]=max(dp[i][j-1],dp[i-1][j]+set[i][j-1]); if(set[i][j]!=0)dp[i][j]=max(dp[i][j],dp[i-1][j]+set[i][j]); if(set[i][j+1]!=0&&j+1=0)dp[i][j-1 阅读全文
posted @ 2013-08-25 22:44 龙城星 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 又一道水题,找出规律就行了#include "iostream"using namespace std;int work(int m,int n){ //cout>m>>n){ cout<<work(m,n)<<endl; }} 阅读全文
posted @ 2013-08-25 21:07 龙城星 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 比我的代码更好的提示typedef struct{ intw,s; intlen,index; intbefore;}mice;建立数据结构时,用index来记录真实的位置,用before来记录排序后,这个元素上一个元素的位置max=m[j].len;flag=j;用j来表示最大的那个数贴上我ACCEPT的代码吧#include "iostream"#include "algorithm"using namespace std;struct student{ int weight,speed;}num[1000],s[10000];struct{ int 阅读全文
posted @ 2013-08-25 19:48 龙城星 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 我有两个想法,其中一个超时,另外一个不知道怎么表达,结果悲剧地看了答案,可惜正确的答案跟我的想法一样ACCEPT#include #include #include using namespace std;const int N = 10000;const int inf = 0xfffffff;int mon[13];int dp[13][N];int main(){ //freopen("data.in", "r", stdin); int m, i, j, k; while(scanf("%d", &m), m) { i 阅读全文
posted @ 2013-08-25 17:05 龙城星 阅读(150) 评论(0) 推荐(0) 编辑