Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.2 kB
4
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;
}
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);
    }
    if(a[1] == 0 && b[1] >= 0 && c[1] >= 0) cout << fixed << setprecision(6) << a[1] << " " << b[1] << " " << c[1];
    else if(b[2] == 0 && a[2] >= 0 && c[2] >= 0) cout << fixed << setprecision(6) << a[2] << " " << b[2] << " " << c[2];
    else if(c[3] == 0 && b[3] >= 0 && c[3] >= 0) cout << fixed << setprecision(6) << a[3] << " " << b[3] << " " << c[3];
}
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