Untitled
#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() { a[1] = 0; b[2] = 0; c[3] = 0; For(i,1,3) { if(i != 1) a[i] = a[i] - (x[i] * p); if(i != 2) b[i] = b[i] - (x[i] * q); if(i != 3) 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