Advertisement
vlatkovski

Broj po broj

Oct 13th, 2017
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int s, k, x;
  6.     cin >> s >> k >> x;
  7.     int c = 0;
  8.  
  9.     stringstream ss;
  10.     ss << x;
  11.     string xs = ss.str();
  12.     ss.str("");
  13.  
  14.     for (int i = s; i <= k; ++i) {
  15.         ss << i;
  16.         string is = ss.str();
  17.         ss.str("");
  18.         if (is.find(xs) != string::npos) {
  19.             c++;
  20.         }
  21.     }
  22.     cout << c;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement