Răspuns :
// Example program
#include <iostream>
#include <string>
using namespace std;
int main(){
int n, x, fin=0, nr=1;
cin>>n;
int aux = n;
while (aux>=10)
{
nr=nr*10; //aflam cate cifre are pentru a parcurge numarul de la inceput la sfarsit aux/=10;
}
cout<<nr<<endl;
aux = n;
while(nr!=0)
{
x= (aux/nr)%10;
if(x % 3 == 0)
{
fin = fin * 10 + x/3;
fin = fin * 10 + x;
}
else
fin = fin * 10 + x; nr/=10; }
cout << fin<<endl;
}
#include <iostream>
#include <string>
using namespace std;
int main(){
int n, x, fin=0, nr=1;
cin>>n;
int aux = n;
while (aux>=10)
{
nr=nr*10; //aflam cate cifre are pentru a parcurge numarul de la inceput la sfarsit aux/=10;
}
cout<<nr<<endl;
aux = n;
while(nr!=0)
{
x= (aux/nr)%10;
if(x % 3 == 0)
{
fin = fin * 10 + x/3;
fin = fin * 10 + x;
}
else
fin = fin * 10 + x; nr/=10; }
cout << fin<<endl;
}
#include <iostream>
using namespace std;
int main()
{
int n,P=1,x=0;
cin>>n;
while(true)
{
x=n%10*P+x;//adaugam cifre 1234 x=4 ; x=3*10+4
P=P*10;
if(n%3==0)
{
x=(n%10/3)*P+x;
P=P*10;
}
n/=10;
if(n<9)
{
cout<<n<<x;
return 0;
}
}
}
using namespace std;
int main()
{
int n,P=1,x=0;
cin>>n;
while(true)
{
x=n%10*P+x;//adaugam cifre 1234 x=4 ; x=3*10+4
P=P*10;
if(n%3==0)
{
x=(n%10/3)*P+x;
P=P*10;
}
n/=10;
if(n<9)
{
cout<<n<<x;
return 0;
}
}
}