[Offer收割]编程练习赛4 register

Ended

Participants:899

Verdict:Time Limit Exceeded
Score:40 / 100
Submitted:2016-08-07 13:10:35

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int N, M;
char s[1005];
int word;
int len[100];
int main() {
    while(scanf("%d %d", &N, &M) != EOF) {
        getchar();
        cin.getline(s, 1005);
        //printf("%s\n", s);
        int slen = strlen(s);
        word = 0;
        for(int i = 0; i < slen; ) {
            if( s[i] != ' ' ) {
                int tmp = 0;
                while( i < slen && s[i] != ' ') {
                    i ++;
                    tmp ++;
                }
                len[word ++] = tmp;
            }
            else i ++;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX