POJ 1007
来源:互联网 发布:谷歌拼音输入法linux 编辑:程序博客网 时间:2024/06/05 05:19
#include <stdio.h>
#include<algorithm>
typedef struct SNode{
int i_value;
char* ca_data;
}SNode;
char ca_buf[5100];
int fCmp(SNode a,SNode b)
{
return a.i_value < b.i_value;
}
int main(void)
{
int len,n,i,j;
SNode sa_output[100];
int ca_value[100][4] = {0};
char* p_index = ca_buf;
scanf("%d %d",&len,&n);
for (i = 0; i < n; ++i,p_index += 51)
{
sa_output[i].ca_data = p_index;
scanf("%s",p_index);
sa_output[i].i_value = 0;
for(j = len -1 ; j>=0;--j)
{
int i_c_value = 4;
switch(p_index[j])
{
case 'A':
++ca_value[i][1];
--i_c_value;
case 'C':
--i_c_value;
++ca_value[i][2];
case 'G':
--i_c_value;
++ca_value[i][3];
case 'T':
--i_c_value;
sa_output[i].i_value += ca_value[i][i_c_value];
break;
}
}
}
std::sort(sa_output,sa_output+n,fCmp);
for(i = 0 ; i < n;++i)
{
printf("%s\n",sa_output[i].ca_data);
}
}
#include<algorithm>
typedef struct SNode{
int i_value;
char* ca_data;
}SNode;
char ca_buf[5100];
int fCmp(SNode a,SNode b)
{
return a.i_value < b.i_value;
}
int main(void)
{
int len,n,i,j;
SNode sa_output[100];
int ca_value[100][4] = {0};
char* p_index = ca_buf;
scanf("%d %d",&len,&n);
for (i = 0; i < n; ++i,p_index += 51)
{
sa_output[i].ca_data = p_index;
scanf("%s",p_index);
sa_output[i].i_value = 0;
for(j = len -1 ; j>=0;--j)
{
int i_c_value = 4;
switch(p_index[j])
{
case 'A':
++ca_value[i][1];
--i_c_value;
case 'C':
--i_c_value;
++ca_value[i][2];
case 'G':
--i_c_value;
++ca_value[i][3];
case 'T':
--i_c_value;
sa_output[i].i_value += ca_value[i][i_c_value];
break;
}
}
}
std::sort(sa_output,sa_output+n,fCmp);
for(i = 0 ; i < n;++i)
{
printf("%s\n",sa_output[i].ca_data);
}
}
0 0
- POJ 1007
- poj 1007
- poj 1007
- POJ 1007
- POJ 1007
- poj 1007
- POJ-1007
- POJ 1007
- poj 1007
- POJ 1007
- POJ-1007
- poj-1007
- POJ 1007
- poj 1007
- POJ 1007
- POJ 1007
- poj 1007
- POJ 1007
- 二级指针的作用详解
- Android GoogleMap suggestion AutoComplete (二)具体实现
- 理解进程调度时机跟踪分析进程调度与进程切换的过程
- Java的语言基础
- AbsListView 浅析
- POJ 1007
- Mysql 表的增删改sql语句
- 蓝桥杯+兰顿蚂蚁
- 数据库三范式通俗说法,书上说的太蛋疼
- Matlab隐函数求导作图
- OpenCV中的神器Image Watch
- GMap.net控件无法加载到工具栏
- 虚拟币开发团队的技术优势是什么?
- 导入项目,项目出现红叉原因