- 博客(11)
- 收藏
- 关注
原创 hdu 5831 栈+模拟
点击打开链接#include #include #include #include using namespace std;const int M=100100;char s[M];stack sta;int main(){ int t; cin>>t; while(t--) { while(!sta.empty()) sta.pop(); int n;
2016-08-11 19:46:34 479
原创 hdu 2795 Billboard线段树运用(单点更新)
点击打开链接#include #include #include using namespace std;const int M =201000;int dat[4*M];int h,w,n;void Push_up(int rt){ dat[rt]=max(dat[rt*2],dat[rt*2+1]);}void build(int l,int r,int rt){
2016-08-11 19:08:18 279
原创 hdu 5805 简单思维题
点击打开链接#include #include #include #include #include #include using namespace std;const int M =101000;long n;long long a[M],f[M],g[M]; // f[i] 1~i中相邻差的最大值 g[i] i~n中相邻差最大值 int main()
2016-08-09 17:43:48 433
原创 hdu 5806尺取法运用
点击打开链接#include #include #include using namespace std;const int M=201000;int n,m,k;int a[M];long long ans;void solve(){ int s=0,t=0,sum=0; while(1) { // as+1~at-1<=as~at-1<m wh
2016-08-09 13:43:32 547
原创 POJ 3276 反转(开关问题)
点击打开链接#include #include #include using namespace std;const int M =5100;int dir[M];// dir[i] 0:F 1;Bint n; int f[M]; // f[i] i~i+k-1的区间是否被翻转过 int calc(int k) //判断第i只cow的State 只要判断 j=i-k+1~
2016-08-06 22:22:02 427
原创 poj 3320 尺取法经典
点击打开链接#include #include #include #include #include using namespace std;const int M=101000;int a[M],p,n;set all;int main(){ int ans=M; cin>>p; for(int i=0;i<p;i++) { scanf("%d",&a[i
2016-08-05 14:58:54 382
原创 poj 3061 Subsequence尺取法
点击打开链接#include #include using namespace std;const int M=101000;int a[M];int main(){ int t; cin>>t; while(t--) { long long sum=0,S; int ans=100100; int n; cin>>n>>S; for(int i=
2016-08-05 14:19:34 405
原创 poj 2456 最大化最小值(二分+贪心)
点击打开链接#include #include using namespace std;const int M = 100100;long n,c;long a[M];bool Check(long x){ int last=0; // 贪心 为了a[num]-a[last]>=x &&num<=n 成立 a[last]要尽量的小 for(int i=2;i<=
2016-08-04 14:34:31 656
原创 poj 1064 二分求最值(水)
点击打开链接#include #include #include #include using namespace std;const int M = 101000;double a[M];int n,k;bool Check(int x) //判断该解是否可行 { int num=0; for(int i=0;i<n;i++) { num+=a[i]/x; }
2016-08-04 13:58:28 313
原创 hdu 5773 字符串水题
统计字符串出现次数点击打开链接#include #include #include #include #include using namespace std;const int M=110; struct Node{ char s[M]; int win;}node[40];void pre(){ int i=0; node[i].win=1;
2016-08-02 17:18:22 369
原创 poj 1837 Balance 01背包(方法数)
点击打开链接#include #include #include using namespace std;const int M =30;int c[M];// hook的位置 int w[M]; //砝码的重量 //放一个砝码对平衡对j所产生的影响为 臂长*重量 c[i]*w[i] int dp[M][16000]; //dp[i][j] 放前i个砝码时 平衡度为j
2016-08-01 15:22:32 338
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人