Dang_Quan_10_Tin

2MULT HSGTPHCM L9 2016-2017

Jan 14th, 2022 (edited)
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #define task "2MULT"
  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. string A, B;
  13.  
  14. void Read()
  15. {
  16.     cin >> A >> B;
  17. }
  18.  
  19. void Solve()
  20. {
  21.     int ans(0);
  22.  
  23.     for(auto i : A)
  24.         for(auto j : B)
  25.             ans = ans + (i - '0') * (j - '0');
  26.    
  27.     cout << ans;
  28. }
  29.  
  30. int32_t main()
  31. {
  32.     ios::sync_with_stdio(0);
  33.     cin.tie(0);
  34.     cout.tie(0);
  35.     if (fopen(task ".INP", "r"))
  36.     {
  37.         freopen(task ".INP", "r", stdin);
  38.         freopen(task ".OUT", "w", stdout);
  39.     }
  40.  
  41.     Read();
  42.     Solve();
  43. }
  44.  
Add Comment
Please, Sign In to add comment