Sort by

recency

|

1181 Discussions

|

  • + 0 comments

    size optimal solution void update(int *a,int *b) { *a = *a + *b; *b = std::abs(a - 2(*b)); }

  • + 0 comments

    void sum(int *,int *); void diff(int *,int *);

    int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int a,b;

    cin>>a>>b;
    
    sum(&a,&b);
    diff(&a,&b);
    
    return 0;
    

    }

    void sum(int *x,int *y) { int sum = *x + *y; cout<

  • + 0 comments

    include

    include

    using namespace std;

    void update(int *a, int *b) { int sum = *a + *b; int diff = abs(*a - *b);

    *a = sum;
    *b = diff;
    

    }

    int main() { int a, b; cin >> a >> b;

    update(&a, &b);
    
    cout << a << endl;
    cout << b << endl;
    
    return 0;
    

    * }****

  • + 0 comments

    include

    include

    using namespace std;

    void update(int *a, int *b) { int sum = *a + *b; int diff = abs(*a - *b);

    *a = sum;
    *b = diff;
    

    }

    int main() { int a, b; cin >> a >> b;

    update(&a, &b);
    
    cout << a << endl;
    cout << b << endl;
    
    return 0;
    

    }

  • + 0 comments
    void update(int *a, int *b) {
        // Complete this function
        *a = *a + *b;
        *b = (*a - 2 * *b > 0? *a - 2 * *b : -*a + 2 * *b);
    }