【十二题解】 | #DNA序列#

DNA序列

http://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a

#include<stdio.h>

int main(){

char data[1000]={0};
while(scanf("%s", data) != EOF){
    int lenth;
    for(lenth=0; data[lenth] != '\0'; lenth++);
    int num;
    int loc =0;
    int count =0;
    int max =0;
    scanf("%d", &num);
    for(int i=0; i+num-1<lenth; i++){
        for(int x=i; x<i+num; x++){
            if(data[x]=='G' || data[x] == 'C')count++;
        }
        if(count>max){
            max = count;
            loc = i;
        }
        count = 0;
    }
    for(int i=0; i<num; i++){
        printf("%c", data[loc+i]);
    }
    printf("\n");
}

}

全部评论

相关推荐

钱嘛数字而已:辅导员肯定不能同意,不然你出事了,他要承担责任。但是,脚和脑子都长在你自己身上,使用它还需要向辅导员报告么? 辅导员必须按流程拒绝你,然后你拿出成年人的态度,做自己的选择。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务