COW3A-EDITORIAL

PROBLEM LINK :

Practice
Contest

Author: Kushagra Kinger
Tester: Kushagra Kinger
Editorialist: Debrup Mandal

DIFFICULTY:

CakeWalk

PREREQUISITES:

None

PROBLEM:

Given a+b, b+c, c+a and a+b+c find a, b, c.

EXPLANATION:

Let the number of apples be ap, number of mangoes be mn and number of oranges be or.
Now, we are given a, b, c, d in the question
a represents total number of apples and mangoes (ap + mn)
b represents total number of oranges and mangoes (or + mn)
c represents total number of apples and oranges (ap + or)
d represents total number of apples and oranges (ap + or + mn)

So, Number of apples are d-b
Number of mangoes are d-c
Number of oranges are d-a

SOLUTIONS:

Setter's Solution
#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--)
    {
        int a , b , c , d;
        cin>>a>>b>>c>>d;
        cout<<d-b<<" "<<d-c<<" "<<d-a<<"\n";
	}
	return 0;
}
1 Like