<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0' gd:etag='W/&quot;DkUFR3Y4eSp7ImA9WhVRFEs.&quot;'><id>tag:blogger.com,1999:blog-2395874771560922606</id><updated>2012-03-22T17:56:56.831-07:00</updated><category term='1.1'/><category term='1'/><title>USACO Training Solutions</title><subtitle type='html'>Some solutions, for reference purposes only.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://usaco-solution.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://usaco-solution.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Victor</name><uri>http://www.blogger.com/profile/09444265449251682901</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-QFx50RmilPo/T2as41CXV8I/AAAAAAAAADY/Si403YJ2zEs/s220/r88-2.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;DkUFR3Y_eSp7ImA9WhVRFEs.&quot;'><id>tag:blogger.com,1999:blog-2395874771560922606.post-671860451629593756</id><published>2012-03-22T17:45:00.004-07:00</published><updated>2012-03-22T17:56:56.841-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2012-03-22T17:56:56.841-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='1.1'/><category scheme='http://www.blogger.com/atom/ns#' term='1'/><title>Greedy Gift Givers (WiP)</title><content type='html'>This one has bugs?&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:cpp"&gt;/*
ID: victor4
PROG: gift1
LANG: C++
*/
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;string&amp;gt;

using namespace std;

struct account{
 string name;
 int money;
};

account *findAccount(string name, account *accounts, int max){
 for(int i = 0; i &amp;lt; max; ++i)
  if(accounts[i].name == name)
   return &amp;amp;accounts[i];
 return NULL;
}

int main() {
 ofstream fout ("gift1.out");
 ifstream fin ("gift1.in");
 
 int NP;
 fin &amp;gt;&amp;gt; NP;
 #define loopa for(int i = 0; i &amp;lt; NP; ++i)
 
 account *accounts = new account[10];
 loopa{
  fin &amp;gt;&amp;gt; accounts[i].name;
  accounts[i].money = 0;
 }
 
 string in = "";
 while(fin &amp;gt;&amp;gt; in){
  account *giver = findAccount(in, accounts, NP);
  if(giver == NULL){
   fout &amp;lt;&amp;lt; "invalid";
   return 1;
  }
  int amount, recv;
  fin &amp;gt;&amp;gt; amount &amp;gt;&amp;gt; recv;
  
  int each = amount / recv;
  int extra = amount % recv;
  giver-&amp;gt;money += extra - amount;
  
  for(int j = 0; j &amp;lt; recv; ++j){
   fin &amp;gt;&amp;gt; in;
   account *reciever = findAccount(in, accounts, NP);
   if(reciever != NULL)
    reciever-&amp;gt;money += each;
  }
 }
 
 loopa{
  fout &amp;lt;&amp;lt; accounts[i].name &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; accounts[i].money &amp;lt;&amp;lt; endl;
 }
 
 delete[] accounts;
 
 return 0;
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2395874771560922606-671860451629593756?l=usaco-solution.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://usaco-solution.blogspot.com/feeds/671860451629593756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/greedy-gift-givers-wip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/671860451629593756?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/671860451629593756?v=2'/><link rel='alternate' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/greedy-gift-givers-wip.html' title='Greedy Gift Givers (WiP)'/><author><name>Victor</name><uri>http://www.blogger.com/profile/09444265449251682901</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-QFx50RmilPo/T2as41CXV8I/AAAAAAAAADY/Si403YJ2zEs/s220/r88-2.gif'/></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;A0cEQ385cSp7ImA9WhVRFEg.&quot;'><id>tag:blogger.com,1999:blog-2395874771560922606.post-4442183143192018676</id><published>2012-03-22T16:30:00.000-07:00</published><updated>2012-03-22T16:30:02.129-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2012-03-22T16:30:02.129-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='1.1'/><category scheme='http://www.blogger.com/atom/ns#' term='1'/><title>Your Ride Is Here</title><content type='html'>This one is also easy! It's too bad I failed a few times due to const-correctness.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:cpp"&gt;/*
ID: victor4
PROG: ride
LANG: C++
*/
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;string&amp;gt;

using namespace std;

int s_product(const char *s){
 int product = 1;
 for(const char *p = s; *p; ++p)
  product *= *p - 'A' + 1;
 return product;
}

int main() {
 ofstream fout ("ride.out");
 ifstream fin ("ride.in");
 
 string s_in1, s_in2;
 fin &amp;gt;&amp;gt; s_in1 &amp;gt;&amp;gt; s_in2;
 
 fout &amp;lt;&amp;lt; (((s_product(s_in1.c_str()) % 47) == (s_product(s_in2.c_str()) % 47)) ? "GO" : "STAY") &amp;lt;&amp;lt; endl;
 
 return 0;
}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2395874771560922606-4442183143192018676?l=usaco-solution.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://usaco-solution.blogspot.com/feeds/4442183143192018676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/your-ride-is-here.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/4442183143192018676?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/4442183143192018676?v=2'/><link rel='alternate' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/your-ride-is-here.html' title='Your Ride Is Here'/><author><name>Victor</name><uri>http://www.blogger.com/profile/09444265449251682901</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-QFx50RmilPo/T2as41CXV8I/AAAAAAAAADY/Si403YJ2zEs/s220/r88-2.gif'/></author><thr:total>0</thr:total></entry><entry gd:etag='W/&quot;AkQHSH4-fSp7ImA9WhVRFEg.&quot;'><id>tag:blogger.com,1999:blog-2395874771560922606.post-7669169208458965943</id><published>2012-03-22T16:10:00.002-07:00</published><updated>2012-03-22T16:18:59.055-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2012-03-22T16:18:59.055-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='1.1'/><category scheme='http://www.blogger.com/atom/ns#' term='1'/><title>Submitting Files</title><content type='html'>This one is really easy; copy, paste, upload... not much of a challenge!&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:cpp"&gt;/*
ID: victor4
PROG: test
LANG: C++
*/
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;string&amp;gt;

using namespace std;

int main() {
 ofstream fout ("test.out");
 ifstream fin ("test.in");
 int a, b;
 fin &amp;gt;&amp;gt; a &amp;gt;&amp;gt; b;
 fout &amp;lt;&amp;lt; a+b &amp;lt;&amp;lt; endl;
 return 0;
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2395874771560922606-7669169208458965943?l=usaco-solution.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://usaco-solution.blogspot.com/feeds/7669169208458965943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/submitting-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/7669169208458965943?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2395874771560922606/posts/default/7669169208458965943?v=2'/><link rel='alternate' type='text/html' href='http://usaco-solution.blogspot.com/2012/03/submitting-files.html' title='Submitting Files'/><author><name>Victor</name><uri>http://www.blogger.com/profile/09444265449251682901</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-QFx50RmilPo/T2as41CXV8I/AAAAAAAAADY/Si403YJ2zEs/s220/r88-2.gif'/></author><thr:total>0</thr:total></entry></feed>