G. Ahnaf and Manha’s Birthday
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/G
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
Ahnaf
and Manha
are brother and sister. Manhas’ Birthday is on 1st September and Ahnaf’s Birthday is on 10th September. So their parents wants to celebrate their birthday on 6th September as it is in the middle of their birthday and wants to give them some present. Manha has N
toys. Ahnaf has double toys than his little sister. on Birthday Party their father and mother gifted them double amount of toys they both have. But unfortunately before the birthday party X
amount of toys has been stolen from Ahnaf’s toy box.
How many toys Manha and Ahnaf both have now after their Birthday Party
Input
You will be given two integer
N
( 1 < N <= 100000000000 )
and X
( X<2N )
in same line separated by single space.Output
Print the total number of toys
Manha
and Ahnaf
both have after their Birthday Party.Samples
Input | Output |
---|---|
2 1 | 15 |
Input | Output |
---|---|
10 6 | 72 |
Solution
#include<stdio.h> int main() { long long n,x,res=0; scanf("%lli%lli",&n,&x); res=((n+2*n)-x)*3; printf("%lli\n",res); return 0; }
No comments:
Post a Comment