Hello fellow programming friends,

I am participating in GCJ for my first time "in an official way". I`m
from Portugal.

I was able to come up with some of the algorithms necessary to solve
some problems, such as "Minimum Scalar Product" in Round 1A 2008.

However, I never got to submit a solution because I can`t handle my I/
O operations with files as I can“t "generalize" my core algorithm to
all the test cases... Can you give me a few pointers?

My code for the above problem was:

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void min_scalar_product(vector<int> &v1, vector<int> &v2)
{
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());

    int min = 0;

    for(int i = 0; i < v1.size(); i++)
    {
        min += v1[i]*v2[v1.size()-(i+1)];
    }
    cout << min;
}

int main()
{
    int nums1[] = {1,3,-5};
    vector<int> v1;
    v1.assign(nums1, nums1+sizeof(nums1));

    int nums2[] = {2,4,-10};
    vector<int> v2;
    v2.assign
    return 0;
}

Can you please help me and also, give me some ideas regarding my
coding style?

Thank you in advance,
Bruno (username Pardal)

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to