forked from fuwutu/CodeForces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path133B - Unary.cpp
54 lines (44 loc) · 885 Bytes
/
133B - Unary.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//4136816 Jul 22, 2013 9:05:14 PM fuwutu 133B - Unary GNU C++0x Accepted 15 ms 0 KB
#include <cstdio>
int main()
{
char p[101];
scanf("%s", p);
int size(0);
for (size_t i = 0; p[i] != 0; ++i)
{
size *= 16;
switch (p[i])
{
case '>':
size += 8;
break;
case '<':
size += 9;
break;
case '+':
size += 10;
break;
case '-':
size += 11;
break;
case '.':
size += 12;
break;
case ',':
size += 13;
break;
case '[':
size += 14;
break;
case ']':
size += 15;
break;
default:
break;
}
size %= 1000003;
}
printf("%d\n", size);
return 0;
}