Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
1.1 kB
3
Indexable
Never
#include <bits/stdc++.h>
#define endl '\n'
#define maxn 10
#define TASK bai1
#define For(i,a,b) for ( int i = a; i <= b; i++ )
#define Ford(i,a,b) for ( int i = a; i >= b; i-- )
#define MOD 100000000000007

using namespace std;
int p,q,r;
double a[maxn],b[maxn],c[maxn],x[maxn];

void inp()
{
    cin >> a[1] >> b[1] >> c[1] >> p >> q >> r;
    a[3] = a[2] = a[1];
    b[3] = b[2] = b[1];
    c[3] = c[2] = c[1];
    x[1] = a[1] / p;
    x[2] = b[1] / q;
    x[3] = c[1] / r;
}
bool check(double a, double b, double c)
{
    if(a < 0 || b < 0 || c < 0) return 0;
    return 1;
}
void solve()
{
    For(i,1,3)
    {
        a[i] = a[i] - (x[i] * p);
        b[i] = b[i] - (x[i] * q);
        c[i] = c[i] - (x[i] * r);
    }
    For(i,1,3)
    if(check(a[i],b[i],c[i])) cout << fixed << setprecision(6) << a[i] << " " << b[i] << " " << c[i];
}
int main()
{
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    if(fopen("bai1.inp","r")){
        freopen("bai1.inp","r",stdin);
    }
    inp();
    solve();
}
Leave a Comment