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\n", res);
50 }
时间: 2024-08-01 22:46:51

CodeForces 412E 手速题的相关文章

CodeForces 408B 手速题

//CodeForces 408B 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 int n1[30], n2[30]; 7 char s1[1010], s2[1010]; 8 int len1, len2; 9 10 int main() 11 {

CodeForces 405B 手速题

//CodeForces 405B 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 char str[3010]; 7 int n; 8 9 int main() 10 { 11 int i, j, res = 0, pos; 12 char c; 13

CodeForces 405A 手速题

//CodeForces 405A 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 int ans[110], n; 7 8 int main() 9 { 10 int i; 11 scanf("%d", &n); 12 for

CodeForces 404A 手速题

//CodeForces 404A 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 char mat[310][310]; 7 int n; 8 bool check_1() 9 { 10 int i; 11 char c = mat[1][1]; 12

CodeForces 404B 手速题

//CodeForces 404B 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 const __int64 N = 1e6; 7 double a, d; 8 int n; 9 10 int main() 11 { 12 int i; 13 scanf

CodeForces 407A 手速题

//CodeForces 407A 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 int square[1010]; 7 struct p 8 { 9 int x, y; 10 }A[1010], B[1010]; 11 int tot_a, tot_b

CodeForces 408A 手速题

//CodeForces 408A 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 using namespace std; 6 int n, k[110], tmp, res = 0x3f3f3f3f; 7 8 int main() 9 { 10 int i, j, ans; 11 scanf(&q

CodeForces 412D 手速题

//CodeForces 412D 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 #include "vector" 6 using namespace std; 7 int tot, first[30010], next[100010], to[100010]; 8 bool

CodeForces 412C 手速题

//CodeForces 412C 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "algorithm" 5 #include "vector" 6 using namespace std; 7 vector<string> str; 8 int n; 9 string res; 10 11 i