Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Task1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <stack>
- #include <sstream>
- using namespace std;
- int main()
- {
- int a, b, p1, p2;
- stringstream sequence;
- stringstream result;
- cin >> a >> b >> p1 >> p2;
- for (int i = a; i <= b; i++) {
- sequence << i;
- }
- for (int i = 0; i < sequence.str().length(); i++) {
- int x = sequence.str()[i] - '0';
- if ((x % p1 != 0) && (x % p2 != 0)) {
- result << x;
- }
- else {
- continue;
- }
- }
- cout << result.str().length();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement