zoukankan      html  css  js  c++  java
  • CodeForces 412E 手速题

    //CodeForces 412E

     1 #include "iostream"
     2 #include "cstdio"
     3 #include "cstring"
     4 #include "algorithm"
     5 #include "vector"
     6 using namespace std;
     7 char str[1000010];
     8 int len;
     9 bool isl(char c)
    10 {
    11     if(c >= 'a' && c <= 'z')
    12         return 1;
    13     if(c >= 'A' && c <= 'Z')
    14         return 1;
    15     return 0;
    16 }
    17 
    18 bool isn(char c)
    19 {
    20     if(c >= '0' && c <= '9')
    21         return 1;
    22     return 0;
    23 }
    24 
    25 int main()
    26 {
    27     int i, j;
    28     scanf("%s", str + 1);
    29     len = strlen(str + 1);
    30     __int64 res = 0, a, b;
    31     for(i = 1; i <= len; ++i) {
    32         if(str[i] == '@') {
    33             a = b = 0;
    34             for(j = i - 1; j >= 1; --j) {
    35                 if(str[j] == '@' || str[j] == '.')
    36                     break;
    37                 if(isl(str[j]))
    38                     ++a;
    39             }
    40             for(j = i + 1; j <= len && (isl(str[j]) || isn(str[j])); ++j);
    41             if(str[j] == '.' && j != i + 1) {
    42                 for(++j; j <= len && isl(str[j]); ++j) {
    43                     ++b;
    44                 }
    45             }
    46             res += a * b;
    47         }
    48     }
    49     printf("%I64d
    ", res);
    50 }
  • 相关阅读:
    个人总结
    第二次冲刺 10
    第二次冲刺 09
    第二次冲刺 08
    第二次冲刺 07
    团队冲刺第七天
    团队绩效评估
    团队冲刺第六天
    团队冲刺第五天
    团队冲刺第四天
  • 原文地址:https://www.cnblogs.com/AC-Phoenix/p/4298842.html
Copyright © 2011-2022 走看看