惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
V
V2EX
量子位
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 【当耐特】
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
小众软件
小众软件
IT之家
IT之家
博客园_首页
博客园 - 聂微东
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗

博客园 - Jeff

4个月 C++ 有限状态机 POJ1019 POJ1035 POJ1005 ONLINE_JUDGE Linux shell定时器 怪异的grep结果 URL2FILE C primer笔记 Vxworks增加system call C语言常用宏定义技巧 分苹果 Socket 为什么选择SMP而不是AMP RTP memory in Vxworks Windriver的项目类型 RTP affinity Symmetric multiprocessing (SMP)
POJ1007
Jeff · 2012-01-05 · via 博客园 - Jeff

2012-01-05 15:03  Jeff  阅读(538)  评论()    收藏  举报

#include "stdio.h"
int main(void) {
    int num;
    int length;
    char str_out[100][51];
    int index;
    int index1;
    int result[100];
    int a=0;
    int b=0;
    int min=0;
    int num2=0;
    int temp;
    int min_index;
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    #else
    #endif

    scanf("%d%d",&length,&num);
    num2=num;
    temp=num2;
    while(num>0){
        scanf("%s", str_out[a]);
        if(num2 == 1){
           printf("%sn",str_out[a]);
           return 0;
        }
        result[a] = 0;
        for(index=0;index<length-1;index++){
            if(str_out[a][index] == 'A')continue;
            else{
               for(index1=index+1;index1<=length-1;index1++){
                   if(str_out[a][index] > str_out[a][index1])result[a]++;
               }
            }

        }
    num--;
    a++;
    }
    while(num2>0){
    if(result[b]==5000)
    {
        b++;
        continue;
    }
    min = result[b];
    min_index = b;

    for(index=0;index<temp-1;index++){
        if(min > result[index+1]){
           min = result[index+1];
           min_index =index+1;
        }
    }
    result[min_index] = 5000;
    num2--;
    printf("%sn",str_out[min_index]);
    min_index = 0;
}
    #ifndef ONLINE_JUDGE
    fclose(stdin);
    #else
    #endif
    return 0;