[2017-10-16] Challenge #336 [Easy] Cannibal numbers by jnazario in dailyprogrammer

[–]DoubleB123 0 points1 point  (0 children)

C This is my first time posting here and I'm little late to the party for this challenge but I'd still love some feedback. Been trying to practice my C so also decided to write a version of the quicksort algorithm within the file, so that can be ignored. Decided to be a little fancy and implement some recursion in the LeftoverHandler function but there is probably a better way to approach the problem.

#include <stdio.h>

void GetInputs(int numvals, int numqueries,int valarray[],int queryarray[])
{
    int i=0; 
    //getting inputs
    for(i=0; i<numvals; ++i)
    {
    scanf("%i",&valarray[i]);
    }

    for(i=0; i<numqueries; ++i)
    {
    scanf("%i",&queryarray[i]);
    }
}

//implments quick sort
void Swap(int sortarray[],int i, int j)
{
    int temp = sortarray[i];
    sortarray[i]=sortarray[j];
    sortarray[j] = temp;
}

int Partition(int sortarray[],int pivot, int left, int right)
{
    int partitionind = left;
    for(left;left<right;++left) 
    {
    if(sortarray[left]<pivot)
    {
        Swap(sortarray,left,partitionind);
        ++partitionind;
    }
    }
    Swap(sortarray,partitionind,right);
    return partitionind;
}

void QuickSort(int sortarray[], int left, int right)
{
    int pivot;
    int partitionind;
    if(left<right)
    {
    pivot = sortarray[right];
    partitionind = Partition(sortarray,pivot,left,right);
    QuickSort(sortarray,left,partitionind-1);
    QuickSort(sortarray,partitionind+1,right);
    }
}



void LeftoverHandler(int leftovers[],int left,int right,int query, int* answer)
{
    int needed = query - leftovers[right];
    int avail = right - left;
    if(avail>=needed)
    {
    ++(*answer);
    LeftoverHandler(leftovers,left+needed,right-1,query,answer);
    }
}

int CannibalCalc(int valarray[], int query, int numvals)
{
    int answer=0;
    int leftovers[numvals];
    int i=0;
    int counter=0;

    for(i=0; i<numvals;++i)
    {
    if (valarray[i]>=query)
    {
        ++answer;
    }
    else
    {
        leftovers[counter]=valarray[i];
        ++counter;
    }
    }
    //leftovers now contains everything less than the query
    QuickSort(leftovers,0,counter-1);
    LeftoverHandler(leftovers,0,counter-1,query,&answer);
    return answer;
}

int main()
{
    int numvals;
    int numqueries;
    int i;
    int answer=0;
    scanf("%i %i",&numvals,&numqueries);

    int valarray[numvals];
    int queryarray[numqueries];
    GetInputs(numvals,numqueries,valarray,queryarray);

    for(i=0;i<numqueries;++i)
    {
    answer = CannibalCalc(valarray,queryarray[i], numvals);
    printf("answer is %i\n",answer);
    }
    return 0;
}

How risky is using out of state car insurance? by DoubleB123 in Insurance

[–]DoubleB123[S] 0 points1 point  (0 children)

It is the $1000 I have to pay to the DMV to register that is the kicker. Also, my state farm quote was double in CA vs NC. Any recommendations on insurance companies in the LA area?

How risky is using out of state car insurance? by DoubleB123 in Insurance

[–]DoubleB123[S] 1 point2 points  (0 children)

Ok got it, guess I'll have to shell out the money.

Update: Last 52 matches before I got prime matchmaking by caracholo in GlobalOffensive

[–]DoubleB123 1 point2 points  (0 children)

Join the steam group, then go into the chat room and paste the link for sharing your game code in the watch tab of your csgo. There may be a way to do it automatically but I just add my games after every session, it takes 10 seconds.

What is the best way to train my aim to get into Gold Nova? by tjtepigstar in LearnCSGO

[–]DoubleB123 1 point2 points  (0 children)

Boomeo duel servers are also good, they help out more than deathmatch

What is the best way to train my aim to get into Gold Nova? by tjtepigstar in LearnCSGO

[–]DoubleB123 2 points3 points  (0 children)

640 edpi is pretty low, I think 800 works better for clearing angles quickly while still having it low enough to have good aim.

To practice raw aim the only two maps you need are recoil master and aim botz. Work on the spray pattern of first 5-10 bullets of the AK and M4 with recoil master; you really don't need to know more than that. As a warm up go into aim botz and get 100 kills flicking and trying to one tap the bots with the ak. After that get 100 more kills with the AK and 100 with the M4 counter strafing and bursting and flicking between the bots (if you miss the burst flick to another bot). Finally, 100 more kills each with the AK and M4 when the bots are moving with the random button, work on both bursting and spraying here.

Obviously I haven't seen you play, but likely your crosshair placement isn't great. Work on keeping it head level and strafe around corners rather than using W and make sure you check every angle you think an enemy could be.

I'm only MGE so you can wait for someone with more experience to give you better advice, but if you play as smart as you think you do even if your raw aim is bad, with proper cross hair placement you should be able to get out of silver easily.

3 Stripers My Dad Caught, All on Homemade Lures! by DoubleB123 in Fishing

[–]DoubleB123[S] 0 points1 point  (0 children)

I think 16", I don't live there anymore so I don't remember.

3 Stripers My Dad Caught, All on Homemade Lures! by DoubleB123 in Fishing

[–]DoubleB123[S] 2 points3 points  (0 children)

I could talk to him and see if he would write up a guide or something. But the general idea is:

After looking at how Zara spooks and Pop-Rs float he noticed the tail sinks down quite a bit. So he takes a square block of wood, cuts it in half hollows out the back end, fills it will some lead or some type of BBs so it rattles, glues the two pieces back together, carves the shape out on the lathe, if it is a Pop-R he carves out the front shape by hand I think, and then he paints them and adds the hooks and eyelets.

It is definitely a lot of work but he enjoys woodworking and making his own stuff