-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicnopause.cpp
58 lines (51 loc) · 1.12 KB
/
basicnopause.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
55
56
57
58
#include <algorithm>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char** argv)
{
int tmp;
ifstream win("words/wordlist");
win >> tmp;
string word;
win >> word; // Eat the rest of the header
map<char,int> presses;
presses['a'] = 1;
presses['b'] = 2;
presses['c'] = 3;
presses['d'] = 1;
presses['e'] = 2;
presses['f'] = 3;
presses['g'] = 1;
presses['h'] = 2;
presses['i'] = 3;
presses['j'] = 1;
presses['k'] = 2;
presses['l'] = 3;
presses['m'] = 1;
presses['n'] = 2;
presses['o'] = 3;
presses['p'] = 1;
presses['q'] = 2;
presses['r'] = 3;
presses['s'] = 4;
presses['t'] = 1;
presses['u'] = 2;
presses['v'] = 3;
presses['w'] = 1;
presses['x'] = 2;
presses['y'] = 3;
presses['z'] = 4;
long long total = 0;
int freq;
while (win >> freq) {
win >> word;
for (string::iterator i = word.begin(); i != word.end(); ++i)
total += freq * presses[*i];
}
cout << total << endl;
return 0;
}