Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- using namespace std;
- string num_to_str(int num)
- {
- stringstream s;
- s << num;
- string a = s.str();
- return a;
- }
- int main ()
- {
- int num0, num5;
- string num;
- int counter = 0;
- for(int i = 100005;i<=999500;i++)
- {
- num0 = 0;
- num5 = 0;
- num = num_to_str(i);
- for(int j = 0;j<6;j++)
- {
- if(num[j] == '0') num0++;
- if(num[j] == '5') num5++;
- }
- if(num0 >= 3 && num5 >= 1)
- {
- counter++;
- cout << i << endl;
- }
- }
- cout << endl << "ilosc: " << counter << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement