1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #include<iostream> #include<set> #include<algorithm> using namespace std;
int main () { for (int i=123; i<=329; i++) { set<int> test1, test2, test3; set<int> a {i/100, i/10%10, i%10}; int double_i = i*2, triple_i = i*3; set<int> b {double_i/100, double_i/10%10, double_i%10}; set<int> c {triple_i/100, triple_i/10%10, triple_i%10}; set_intersection (a.begin (), a.end (), b.begin (), b.end (), inserter (test1, test1.begin ())); set_intersection (a.begin (), a.end (), c.begin (), c.end (), inserter (test2, test2.begin ())); set_intersection (c.begin (), c.end (), b.begin (), b.end (), inserter (test3, test3.begin ())); if (test1.empty () && test2.empty () && test3.empty () && a.count (0)==0 && b.count (0)==0 && c.count (0)==0 && a.size ()==3 && b.size ()==3 && c.size ()==3) cout << i << "" << double_i <<" " << triple_i << endl; } return 0; }
|