Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fr[10] = {5,7,2,4,5,8,9,12,6,4};
- int fr2[10];
- int cif=-1;
- int main()
- {
- for(int i=0; i<=9; i++) fr2[i]=fr[i];
- for(int i=8; i>=2; i-=2)
- if (fr[i]>1) {
- cif = i;
- fr[i]-=2;
- break;
- }
- if (cif==-1) {cout << "nu mere"; return 0;};
- cout << cif;
- for(int i=9; i>=0; i--)
- {
- while (fr[i]>=2)
- {
- fr[i]-=2;
- cout << i;
- }
- }
- for(int i=9; i>=0; i--)
- {
- if (fr[i]){
- cout << i;
- break;
- }
- }
- for(int i=0; i<=9; i++)
- {
- while (fr2[i]>=2)
- {
- fr2[i]-=2;
- cout << i;
- }
- }
- cout << cif;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement