Advertisement
Josif_tepe

Untitled

Feb 17th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int k;
  8.     int m;
  9.     int n;
  10.     int brojac=0;
  11.     int cifri=0;
  12.     cin>>k;
  13.     cin>>m;
  14.     cin>>n;
  15.     int y=0;
  16.     vector<int>v;
  17.     for(int u = k; u <= m; u+=1){
  18.         v.push_back(u);
  19.     }
  20.     for(int u1=0; u1<v.size(); u1+=1){
  21.     if(v[u1]/1000!=0){
  22.         cifri+=4;
  23.     }
  24.     else if(v[u1]/100!=0){
  25.         cifri+=3;
  26.     }
  27.     else if(v[u1]/10!=0){
  28.         cifri+=2;
  29.     }
  30.     else if(v[u1]/1!=0){
  31.         cifri+=1;
  32.     }
  33.      }
  34.     int rezultat = cifri;
  35.     y = n;
  36.     while(y<=cifri){
  37.         rezultat--;
  38.         y += n;
  39.        
  40.     }
  41.     cout<<rezultat;
  42.  
  43.     return 0;
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement