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

Ended

Participants:188

Verdict:Wrong Answer
Score:80 / 100
Submitted:2017-10-08 12:57:58

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 <iostream>
#include <cstring>
#include <stdio.h>
using namespace std;
char s[1000];
int subs[1000][2],tot;
int main()
{
    string s;
    getline(cin,s);
    tot=0;
    bool in=false;
    for(int i=0;i<s.length();i++){
        if(i<s.length()&&s[i]=='@'){
            if(in)tot++;
            subs[tot][0]=i+1;
            subs[tot][1]=i;
            in=true;
        }else if(in){
            if(('a'<=s[i]&&s[i]<='z')||('A'<=s[i]&&s[i]<='Z'))
                subs[tot][1]++;
            else{
                tot++;
                in=false;
            }
        }
    }
    if(in){
        if(('a'<=s[s.length()-1]&&s[s.length()-1]<='z')||('A'<=s[s.length()-1]&&s[s.length()-1]<='Z')){
            subs[tot++][1]++;
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX