上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 57 下一页

2011年7月22日

poj 1040 Transportation

摘要: #include<iostream> //dfs#include<algorithm>using namespace std;struct node { int s,t,num; bool operator<(const node& o) { if(s==o.s) return t<o.t; return s<o.s; }}pas[30];int cap,b,order,arr[10],res;void dfs(int i,int sum){ if(i==order) { res=max(res,sum); return; } int temp 阅读全文

posted @ 2011-07-22 16:56 sysu_mjc 阅读(194) 评论(0) 推荐(0) 编辑

poj 1017 Packets

摘要: #include <iostream>using namespace std;int main(){ int arr[8]; while(cin>>arr[1]>>arr[2]>>arr[3]>>arr[4]>>arr[5]>>arr[6]) { if(arr[1]+arr[2]+arr[3]+ar r[4]+arr[5]+arr[6]==0) break; int pack=0; pack+=arr[6]+arr[5]; arr[1]=arr[1]>arr[5]*11?arr[1]-arr[5]*11: 阅读全文

posted @ 2011-07-22 16:55 sysu_mjc 阅读(133) 评论(0) 推荐(0) 编辑

poj 1028 Web Navigation

摘要: #include <iostream> //水题#include <string>#include<stack>using namespace std;int main(){ stack<string> back,forword; string str,current="http://www.acm.org/"; while(cin>>str&&str!="QUIT") { if(str=="VISIT") { back.push(current); cin& 阅读全文

posted @ 2011-07-22 16:55 sysu_mjc 阅读(144) 评论(0) 推荐(0) 编辑

poj 3982 序列

摘要: #include <iostream>#include <string>using namespace std;int compare(string str1, string str2){ while(!str1.empty()&&str1[0]=='0') { str1.erase(0,1); } while(!str2.empty()&&str2[0]=='0') { str2.erase(0,1); } if(str1.size() > str2.size()) //长度长的整数大于长度小的整数 阅读全文

posted @ 2011-07-22 16:54 sysu_mjc 阅读(193) 评论(0) 推荐(0) 编辑

poj 3751 时间日期格式转换

摘要: #include <iostream> //水题using namespace std; //12:00pm 表示正午,12:00am表示午夜int main(){ int t,y,mm,d,h,m,s,tag;char ch[2][3]={"am","pm"}; cin>>t; while(t--) { scanf("%d/%d/%d-%d:%d:%d",&y,&mm,&d,&h,&m,&s); if(h<12) tag=0,h=(h==0)?12:h; 阅读全文

posted @ 2011-07-22 16:53 sysu_mjc 阅读(106) 评论(0) 推荐(0) 编辑

poj 3750 小孩报数问题

摘要: #include<iostream>#include<string>#include <vector>using namespace std;struct Node { int index; string str; Node(int i,string s) { index=i;str=s; }};vector<Node> table;int main(){ int n,w,s,i,ans; string str; cin>>n; for (i=1;i<=n;++i) { cin>>str; Node node(i,s 阅读全文

posted @ 2011-07-22 16:52 sysu_mjc 阅读(156) 评论(0) 推荐(0) 编辑

poj 3652 Persistent Bits

摘要: #include <iostream>using namespace std;int bin[16];bool visited[70000];int main(){ int a,b,c,s,temp,i; while(cin>>a&&a) { cin>>b>>c>>s; memset(bin,0,sizeof(bin)); memset(visited,0,sizeof(visited)); visited[s]=1; i=15;temp=s; while(temp) { bin[i--]=temp%2; temp/= 阅读全文

posted @ 2011-07-22 16:51 sysu_mjc 阅读(101) 评论(0) 推荐(0) 编辑

poj 3740 Easy Finding

摘要: #include<iostream> //按列dfs暴搜 using namespace std;int m,n,table[18][305],visited[18],tag[305],num;void dfs(int start){ int i,j,over; if(tag[start]==1) dfs(start+1); else for(i=0;i<m;++i) { if(visited[i]==1||table[i][start]==0) continue; over=0; for(j=0;!over&&j<n;++j) if(table[i][ 阅读全文

posted @ 2011-07-22 16:51 sysu_mjc 阅读(120) 评论(0) 推荐(0) 编辑

poj 3399 Product

摘要: #include<iostream>#include<algorithm>#include<functional>using namespace std;__int64 data[105],pos[105],neg[105],len1,len2,count0;__int64 n,k,i,ans[2][105];void printout(__int64 a,__int64 b,__int64 c,bool tag){ for(i=len1-1;i>len1-1-a;--i) cout<<pos[i]<<" " 阅读全文

posted @ 2011-07-22 16:50 sysu_mjc 阅读(186) 评论(0) 推荐(0) 编辑

poj 3368 Frequent values

摘要: /* 题意: 有一组不下降的数 a1...an ,查询[s,t]区间内相同元素出现次数的最大值 思路: 首先对给出的原序列 origin 进行统计,将相同的数字放进同一组内:group[i][0],group[i][1], 记录在原序列中该组起点和终点的位置. 再记录原序列每个元素分别属于哪一组 之后就是查询[s,t], 假定元素origin[s],origin[t]分别属于 l_group, r_group组 注意到序列是不下降的,于是有3种可能性: 1.如果元素origin[s],origin[t]属于同一个组,那么该组长度就是我们想要的答 案 t-s+1; 2.如果元素or... 阅读全文

posted @ 2011-07-22 16:49 sysu_mjc 阅读(159) 评论(0) 推荐(0) 编辑

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 57 下一页

导航