Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int a, b, ans, k, j;
  5. int v[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  6. int pot[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
  7.  
  8. int main() {
  9.     ios::sync_with_stdio(0);
  10.     cin.tie(0);
  11.     cout.tie(0);
  12.    
  13.     cin >> a >> b;
  14.        
  15.     for(int i=a;i<=b;i++) {
  16.         k = 6, j=i;
  17.         while(k>0 && pot[k] > i) --k;
  18.        
  19.         for(;k>=0;k--) {
  20.             ans += v[int(j / pot[k])];
  21.             j %= pot[k];
  22.         }
  23.     }
  24.     cout << ans << endl;
  25.     return EXIT_SUCCESS;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement