• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
asdflkj
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 下一页

2014年10月3日

hdu 4778 Gems Fight!(状态压缩DP)
摘要: 又是一道状态压缩,刚开始老是往博弈的方法想,总是没思路。#include #include #include #include using namespace std;const int N=21;const int inf=0x3f3f3f3f;int g,n,s;int sum[1<<N];in... 阅读全文
posted @ 2014-10-03 02:11 asdflkj 阅读(190) 评论(0) 推荐(0)
 
hdu 5036 Explosion
摘要: 学了下bitset#include #include #include using namespace std;const int N=1005;bitseta[N];int t,n,cas=1,c;int main(){ cin>>t; while(t--){ scanf... 阅读全文
posted @ 2014-10-03 02:08 asdflkj 阅读(431) 评论(0) 推荐(0)
 
 

2014年9月27日

soj 1088. Cows(树状数组)
摘要: 可以用树状数组解决。先按左端点递增排序,左端点相等的按右端点降序排列。然后从左往有扫,更新答案同时更新sum数组。对于一只Cow i,ans[i]为f(i)-g(i).f(i)为满足p[j].s=p[i].e(0#include #include #include #include using na... 阅读全文
posted @ 2014-09-27 22:49 asdflkj 阅读(196) 评论(0) 推荐(0)
 
hdu 5050 Divided Land(JAVA高精度)
摘要: import java.util.Scanner;import java.math.BigInteger;public class Main { public static void main(String[] args) { Scanner cin=new Scanner(Sy... 阅读全文
posted @ 2014-09-27 21:53 asdflkj 阅读(155) 评论(0) 推荐(0)
 
 

2014年9月26日

hdu 5001 Walk(概率DP)
摘要: 水水的#include #include #include #include #include #include using namespace std;int t,n,m,d;vectorg[55];bool w[55][55];double dp[2][55];double dfs(int x)... 阅读全文
posted @ 2014-09-26 11:55 asdflkj 阅读(154) 评论(0) 推荐(0)
 
 

2014年9月25日

hdu 5009 Paint Pearls (DP)
摘要: 从前往后DP;先离散化;假设DP到第i个位置。las[i]表示第i种颜色最后一次出现的位置。t[k]表示满足w(t[i],i)==k的最小下标,w(a,b)表示从a,a+1,a+2......b这段区间的不同颜色的数量是多少。然后每次先更新t数组,再更新dp数组,k只需从1枚举到sqrt(n),所以... 阅读全文
posted @ 2014-09-25 12:05 asdflkj 阅读(152) 评论(0) 推荐(0)
 
 

2014年9月23日

hdu 4107 Gangster 线段树(成段更新)
摘要: 维护每个区间的最小值和最大值,update的时候判断low[rt]与up[rt]和p的大小关系,进行更新操作。卡时卡得很紧。#include #include #include #include #include #define lson l,m,rtb)return a; return b;... 阅读全文
posted @ 2014-09-23 20:30 asdflkj 阅读(209) 评论(0) 推荐(0)
 
hdu 3037 Saving Beans (lucas定理)
摘要: 考虑加多一颗树,这样的话当加的树放了k(0#include #include #include #include using namespace std;typedef long long ll;ll n,m,p;ll POW(ll x,ll n,ll p){ ll res=1; whi... 阅读全文
posted @ 2014-09-23 13:18 asdflkj 阅读(235) 评论(0) 推荐(0)
 
hdu 3944 DP? (Lucas 定理)
摘要: 仔细观察杨辉三角后可以发现从最高点到第n行第k个数的最短路为c(n+1,k);根据Lucas定理可以求出,一般来说要求答案模去一个质数p且p的范围不大于10^5则可用Lucas.Lucas(n,m,p)=cm(n%p,m%p)* Lucas(n/p,m/p,p)Lucas(x,0,p)=1;另外注意... 阅读全文
posted @ 2014-09-23 00:31 asdflkj 阅读(205) 评论(0) 推荐(0)
 
 

2014年9月21日

hdu 5038 Grade 水
摘要: 用map,也可以用数组,少了个特判WA了一发。#include #include #include #include #include #include #include using namespace std;const int maxn=1000005;int n;int a[maxn];int... 阅读全文
posted @ 2014-09-21 19:21 asdflkj 阅读(176) 评论(0) 推荐(0)
 
 
上一页 1 2 3 下一页

公告


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