TOPIC

Time limit exceeded / Runtime error

DuarteRodrigues asked 3 years ago

Penso que o erro esteja no facto de não ter em conta o facto do EOF mas não tenho a certeza. Também tentei colocar
while(!feof(stdin) && scanf("%d %d %d", &N, &L, &C) == 3) mas desta forma dá Runtime error. Alguém me consegue ajudar?

Question solved. Code removed.

This topic was solved and cannot recieve new replies.

  • DuarteRodrigues replied 3 years ago

    Thank you very much! It worked properly!

  • feodorv replied 3 years ago

    You can simply try

        while( scanf("%d %d %d", &N, &L, &C) == 3 )

    As for RTE.

    #define MAX 30
    ...
        char palavra[MAX];

    Too small buffer size. Read attentively the problem statement:

    1 <= length of each word <= C

    1 <= C <= 70

    And you need to increase it on at least 1 byte for '\0'. I see no reason to be greedy. I've used 128 bytes:

          char w[128];