zoj 1076 Gene Assembly
2014-01-10 09:56
441 查看
题意:就是找最长的外显子序列。给出的是可能的外显子的个数和每个外显子的开始序列和结尾序列。
外显子i在j前面当且仅当i的结尾小于j的开头编号。
分析:
按结束编号递增排序。类似于活动安排。
外显子i在j前面当且仅当i的结尾小于j的开头编号。
分析:
按结束编号递增排序。类似于活动安排。
#include<cstdio> #include<algorithm> using namespace std; struct node { int s,e,id; }gene[1010]; bool cmp(node x,node y) { return x.e<y.e; } int main() { int n; while(scanf("%d",&n)&&n) { for(int i=1;i<=n;i++) { scanf("%d%d",&gene[i].s,&gene[i].e); gene[i].id=i; } sort(gene+1,gene+n+1,cmp); printf("%d",gene[1].id); int tmp=gene[1].e; for(int i=2;i<=n;i++) { if(gene[i].s>tmp) { printf(" %d",gene[i].id); tmp=gene[i].e; } } printf("\n"); } return 0; }
相关文章推荐
- zoj1076-Gene Assembly
- ZOJ --- 1076 Gene Assembly
- ZOJ 1076 Gene Assembly (贪心求区间不相交问题)
- ZOJ 1076 Gene Assembly(LIS)
- ZOJ1076-Gene Assembly(贪心)
- ZOJ 1076 Gene Assembly(LIS+路径打印 贪心)
- ZOJ-1076 Gene Assembly
- zoj1076
- 贪心,Gene Assembly,ZOJ(1076)
- zoj1076 Gene Assembly 活动安排 dp
- ZOJ 1076 Gene Assembly
- ZOJ 1076
- ZOJ Problem Set - 1076
- ZOJ 1076 Gene Assembly
- zoj - 1076 - Gene Assembly
- ZOJ 1076 Gene Assembly LIS
- ZOJ 1076 Gene Assembly
- zoj - 1076 - Gene Assembly
- zoj 1076 Gene Assembly 贪心
- ZOJ 1076 Gene Assembly LIS