-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathP11385.cpp
49 lines (46 loc) · 870 Bytes
/
P11385.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
int main() {
// Build fibs:
map<long,int> FIB;
FIB[1] = 0;
FIB[2] = 1;
long pp = 1;
long p = 2;
long f;
int idx = 2;
while((f = pp+p) < 4000000000) {
FIB[f] = idx++;
pp = p;
p = f;
}
char ret[109];
FORCAS {
vector<int> firstLine;
vector<char> secondLine;
memset(ret, ' ', sizeof(ret));
int max = -1;
GI(N);
FORI(N) {
GI(x);
int y = FIB[x];
firstLine.push_back(y);
if(y > max)
max = y;
}
string s;
getline(cin, s);
getline(cin, s);
//cerr << "Cipher: '" << s << "'" << endl;
FORUI(s.size()) {
char c = s[i];
if(c >= 'A' && c <= 'Z')
secondLine.push_back(c);
}
FORUI(firstLine.size()) {
int x = firstLine[i];
ret[x] = secondLine[i];
}
ret[max+1] = '\0';
cout << ret << endl;
}
return 0;
}