Working together,rajeev and vikram can complete a piece of work in 48 days.Rajeev can complete the work alone in 64 days.Both of them worked together for 30 days and then rajeev left.How long will vikram take to complete the remaining work?
Answers
Answer:
Step-by-step explanation:
This problem can be done using lcm concept
quantity of work to be done=lcm(64,48)=192units
work done by rajeev and vikram=192/48=4units/day
work done by rajeev =192/64=3units/day
so work done by vikram=4-3=1units/day
work done by rajjev and vikram in 30 days=30*4=120units
Remaining work to be done by vikram=12-120=72units
so time taken by vikram to complete 72 units=72/1=72days2 years ago
Hope it helps you....
first sort the array in nlgn and then its easy just take two pointers one pointing ats start index of array and one at the end of the array and start checking sum
like this
whwrw a is the integer array givcen
int *p;
int *q;
p=a;
q=a+n-1;
while(p!=q)
{
if(*p+*q==sum)
{printf("(%d,%d)\n",*p,*q);
p++;
q--;
continue;}
if(*p+*q<sum)
{
p++;
continue;
}
q--;
}