Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cstring>
- using namespace std;
- void chesel(int &a, int &b) {
- int tmp_a = a;
- int tmp_b = b;
- int sz = 1;
- while(tmp_a) {
- sz *= 10;
- tmp_a /= 10;
- }
- tmp_a = a;
- int pa = 0, pb = 0;
- while(tmp_a) {
- int ca = tmp_a % 10;
- int cb = tmp_b % 10;
- if(ca % 2 == 0) {
- pa = (pa * 10) + cb;
- pb = (pb * 10) + ca;
- }
- else {
- pa = (pa * 10) + ca;
- pb = (pb * 10) + cb;
- }
- tmp_a /= 10;
- tmp_b /= 10;
- }
- a = 0;
- b = 0;
- int aa = 0, bb =0 ;
- while(pa) {
- a = (a * 10) + (pa % 10);
- pa /= 10;
- aa++;
- }
- while(pb) {
- b = (b * 10) + (pb % 10);
- pb /= 10;
- bb++;
- }
- while(aa < bb) {
- aa++;
- a *= 10;
- }
- while(bb < aa) {
- bb++;
- b *= 10;
- }
- return;
- }
- int main() {
- int a, b;
- cin >> a >> b;
- chesel(a, b);
- cout << a << " " << b << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement