#3077: 一直TLF


falchion (阿毛)

學校 : 臺北市立大學
編號 : 10158
來源 : [114.25.17.32]
最後登入時間 :
2017-08-21 21:47:51
d517. 文字抄寫 I | From: [59.112.38.137] | 發表日期 : 2009-12-20 22:47

#include <stdio.h>
#include <string.h>

int main()
{
    int times , count1 , count2 , count3 , count4 , correct ;
    char array[100000][5] , temp[5] ;
    while (  scanf("%d" , &times ) == 1 )
    {
        count2 = 0 ;
        for ( count1 = 0 ; count1 < times ; count1++ )
        {
            scanf("%s" , temp);
            correct = 0;
            for ( count3 = 0 ; count3 < count2 ; count3++ )
            {
                for ( count4 = 0 ; count4 < 5 ; count4++ )
                {
                    if ( array[count3][count4] != temp[count4] )
                        break;
                }  
                if ( count4 == 5 )
                {
                    printf("Old! %d\n" , count3 + 1 );
                    correct = 1;
                    break;
                }
            }
            if ( correct == 0 )
            {
                printf("New! %d\n" , count2 + 1 );
                strcpy(array[count2] , temp );
                count2++;
            }
        }
    }
    return 0;   
}

有辦法更快嗎?

我黔驢繼窮了......

 請高手賜教

 
ZeroJudge Forum