Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int q;
- int qarr[10];
- int karr[10];
- int copy;
- int size=0;
- cin >> q;
- copy = q;
- for(; copy>0; copy/=10){
- size++;
- }
- for(int i=0; i<10; i++){
- qarr[i]=0;
- }
- copy = q;
- for(int i=0; copy>0; i++, copy/=10){
- qarr[copy % 10]++;
- }
- for (int k = pow(10.0, size-1); k < pow(10.0, size); k++)
- {
- for(int i=0; i<10; i++){
- karr[i]=0;
- }
- copy = k;
- for(int i=0; copy>0; i++, copy/=10){
- karr[copy % 10]++;
- }
- for (int i = 0; i < 10; i++) {
- if(karr[i]!=qarr[i]) break;
- if(i==9) cout<<k<<endl;
- }
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement