摘要: #include#include#include#include#include#includeusing namespace std;int main(){ int t,n,s,p,a,sum,i; scanf("%d",&t); for(i=1;i=p*3-2) sum++; if(a>=p*3-4&&a<=p*3-3&&s) { sum++; s--; } } printf("Case #%d: ... 阅读全文
posted @ 2013-07-22 16:58 nylg-haozi 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#includeusing namespace std;int a,dp[100010],top;int find(int l,int r,int temp){ while(ldp[top]) dp[++top]=a; else dp[find(1,top,a)]=a; } printf("%d\n",top); } return 0;} 阅读全文
posted @ 2013-07-22 10:49 nylg-haozi 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#includeusing namespace std;int a[25],dp[30];int main(){ int n,m,i,j; scanf("%d",&n); while(n--) { scanf("%d",&m); scanf("%d",&a[0]); dp[0]=1; int max=dp[0]; for(i=1;it&&a[j]>a[i]) t=dp[j]; ... 阅读全文
posted @ 2013-07-22 09:41 nylg-haozi 阅读(116) 评论(0) 推荐(0) 编辑
摘要: STL中优先队列的使用方法(priority_queu)基本操作:empty() 如果队列为空返回真pop() 删除对顶元素push() 加入一个元素size() 返回优先队列中拥有的元素个数top() 返回优先队列对顶元素在默认的优先队列中,优先级高的先出队。在默认的int型中先出队的为较大的数。使用方法:头文件:#include声明方式:1、普通方法:priority_queueq;//通过操作,按照元素从大到小的顺序出队2、自定义优先级:structcmp{operatorbool()(intx,inty){return x>y;//x小的优先级高//也可以写成其他方式,如:ret 阅读全文
posted @ 2013-07-22 08:36 nylg-haozi 阅读(109) 评论(0) 推荐(0) 编辑