Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

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

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

InputOutput
2 115
InputOutput
10 672


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