Advertisement
Dang_Quan_10_Tin

PATH TS10 PTNK 2006-2007

Jan 15th, 2022
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #define task "PATH"
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. using ll = long long;
  9. using ld = long double;
  10.  
  11. constexpr int N = 1e5 + 5;
  12. int n;
  13. ll s, d;
  14.  
  15. void Read()
  16. {
  17.     cin >> n >> d;
  18.     for (int i = 1; i <= n; ++i)
  19.     {
  20.         int v;
  21.         char c;
  22.         cin >> c >> v;
  23.  
  24.         s += v;
  25.     }
  26. }
  27.  
  28. void Solve()
  29. {
  30.     cout << s * d;
  31. }
  32.  
  33. int32_t main()
  34. {
  35.     ios::sync_with_stdio(0);
  36.     cin.tie(0);
  37.     cout.tie(0);
  38.     if (fopen(task ".INP", "r"))
  39.     {
  40.         freopen(task ".INP", "r", stdin);
  41.         freopen(task ".OUT", "w", stdout);
  42.     }
  43.  
  44.     Read();
  45.     Solve();
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement