|
| 1 | +/* Code Chef */ |
| 2 | +/* Title - Maximum Production */ |
| 3 | +/* Created By - Akash Modak */ |
| 4 | +/* Date - 12/07/2021 */ |
| 5 | + |
| 6 | +// Chefland has 7 days in a week. Chef is very conscious about his work done during the week. |
| 7 | + |
| 8 | +// There are two ways he can spend his energy during the week. The first way is to do x units of work every day and the second way is to do y (>x) units of work for the first d (<7) days and to do z (<x) units of work thereafter since he will get tired of working more in the initial few days. |
| 9 | + |
| 10 | +// Find the maximum amount of work he can do during the week if he is free to choose either of the two strategies. |
| 11 | + |
| 12 | +// Input |
| 13 | +// The first line contains an integer T, the number of test cases. Then the test cases follow. |
| 14 | +// Each test case contains a single line of input, four integers d, x, y, z. |
| 15 | +// Output |
| 16 | +// For each testcase, output in a single line the answer to the problem. |
| 17 | + |
| 18 | +// Sample Input |
| 19 | +// 3 |
| 20 | +// 1 2 3 1 |
| 21 | +// 6 2 3 1 |
| 22 | +// 1 2 8 1 |
| 23 | +// Sample Output |
| 24 | +// 14 |
| 25 | +// 19 |
| 26 | +// 14 |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +#include<bits/stdc++.h> |
| 31 | +#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); |
| 32 | +#define F first |
| 33 | +#define S second |
| 34 | +#define pb push_back |
| 35 | +#define MP make_pair |
| 36 | +#define REP(i,a,b) for (int i = a; i <= b; i++) |
| 37 | +#define FLSH fflush(stdout) |
| 38 | +#define count_1(n) __builtin_popcountll(n) |
| 39 | +#define max(x,y) (x>y)?x:y |
| 40 | +#define min(x,y) (x<y)?x:y |
| 41 | +#define mid(s,e) (s+(e-s)/2) |
| 42 | +#define mini INT_MIN |
| 43 | +#define maxi INT_MAX |
| 44 | + |
| 45 | +const int MOD = 1000000007; |
| 46 | +const int FMOD = 998244353; |
| 47 | +using namespace std; |
| 48 | + |
| 49 | +typedef long long int ll; |
| 50 | +typedef vector<int> vi; |
| 51 | +typedef pair<int,int> pi; |
| 52 | + |
| 53 | +int main() { |
| 54 | + // your code goes here |
| 55 | + fast; |
| 56 | + int t; |
| 57 | + cin>>t; |
| 58 | + while(t--){ |
| 59 | + int d,x,y,z; |
| 60 | + cin>>d>>x>>y>>z; |
| 61 | + ll for_x = 7*x; |
| 62 | + ll for_other = (d*y)+((7-d)*z); |
| 63 | + if(for_x>for_other){ |
| 64 | + cout<<for_x<<"\n"; |
| 65 | + } |
| 66 | + else{ |
| 67 | + cout<<for_other<<"\n"; |
| 68 | + } |
| 69 | + } |
| 70 | + return 0; |
| 71 | +} |
0 commit comments