Advertisement
halexandru11

Untitled

Dec 7th, 2021
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. #include <algorithm>
  2. #include <array>
  3. #include <bitset>
  4. #include <cassert>
  5. #include <climits>
  6. #include <cmath>
  7. #include <complex>
  8. #include <cstdio>
  9. #include <cstdlib>
  10. #include <cstring>
  11. #include <fstream>
  12. #include <functional>
  13. #include <iomanip>
  14. #include <iostream>
  15. #include <map>
  16. #include <memory>
  17. #include <numeric>
  18. #include <queue>
  19. #include <random>
  20. #include <set>
  21. #include <stack>
  22. #include <string>
  23. #include <unordered_set>
  24. #include <unordered_map>
  25. #include <vector>
  26. using namespace std;
  27.  
  28. /// START Errichto's debug
  29. #define sim template < class c
  30. #define ris return * this
  31. #define dor > debug & operator <<
  32. #define eni(x) sim > typename \
  33. enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
  34. sim > struct rge { c b, e; };
  35. sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
  36. sim > auto dud(c* x) -> decltype(cerr << *x, 0);
  37. sim > char dud(...);
  38. struct debug {
  39. #ifdef LOCAL
  40. ~debug() { cerr << endl; }
  41. eni(!=) cerr << boolalpha << i; ris; }
  42. eni(==) ris << range(begin(i), end(i)); }
  43. sim, class b dor(pair < b, c > d) {
  44. ris << "(" << d.first << ", " << d.second << ")";
  45. }
  46. sim dor(rge<c> d) {
  47. *this << "[";
  48. for (auto it = d.b; it != d.e; ++it)
  49. *this << ", " + 2 * (it == d.b) << *it;
  50. ris << "]";
  51. }
  52. #else
  53. sim dor(const c&) { ris; }
  54. #endif
  55. };
  56. #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  57. // debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
  58. /// END Errichto's debug
  59.  
  60. #define ff first
  61. #define ss second
  62. #define eb emplace_back
  63. #define mp make_pair
  64. #define pb push_back
  65. #define ppb pop_back
  66. #define all(a) a.begin(), a.end()
  67. #define rall(a) a.rbegin(), a.rend()
  68. #define f0(i, n) for(int i = 0; i < n; ++i)
  69. #define fo(i, k, n) for(int i = k; i < n; ++i)
  70. #define foo(i, a, b, k) for(int i = a; i < b; i += k)
  71. #define rf0(n, i) for(int i = n-1; ~i; --i)
  72. #define rfo(n, k, i) for(int i = n-1; i >= k; --i)
  73. #define rfoo(b, a, k, i) for(int i = b; i > a; i -= k)
  74. #define Im_speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
  75.  
  76. typedef long double ld;
  77. typedef uint32_t uint;
  78. typedef int64_t ll;
  79. typedef uint64_t ull;
  80.  
  81. //ifstream fin("date.in");
  82. //ofstream fout("date.out");
  83.  
  84. const int nax = 1e5 + 3;
  85. const int mod = 1e9 + 7;
  86. const int inf = 1e9 + 7;
  87. const ll infll = 1e18 + 7;
  88. const ld PI = 3.1415926535897932384626433832795;
  89.  
  90. void test_case() {
  91. vector<int> a(4);
  92. f0(i, 4) {
  93. cin >> a[i];
  94. }
  95. string s;
  96. cin >> s;
  97. ll ans = 0;
  98. for(char c : s) {
  99. ans += a[c - '0' - 1];
  100. }
  101. cout << ans;
  102. }
  103.  
  104. int main() {
  105. // clock_t _clock = clock();
  106. Im_speed;
  107. cout << fixed << setprecision(12);
  108.  
  109. int t = 1;
  110. // cin >> t;
  111. while(t--) {
  112. test_case();
  113. }
  114.  
  115. // cout << "\n\nTime: " << ((((double) clock()) - ((double)_clock)) / ((double) CLK_TCK));
  116. }
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement