MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayThis Challenge is to solve the USC Spring 2013 ACM Contest Problem A, Relief Supplies.

The theme for Spring 2013 is Snowstorm.

Summary of Challenge is to Optimize your family's most needed Relief Supplies while never being the sole maximum distribution receiver of your preferred item.

Distribution is to N families; T items; quantity B of each item; Selected item is S. 2<=N<101; S<=T; 1<=B,T<101

Distribution of T=5 and B=2 to 10 families would be 1 2 3 4 5 1 2 3 4 5. Distribution of items cycle.

Return the Position in Line of N families that is the last to receive the second most of your selected item or the last to receive the most of the item if multiple families receive this maximum amount.

**Input NTSB:** 4 6 3 5 **Output:** 3

**Input NTSB:** 4 3 6 1 **Output:** 4

Winner Cao's C solution (15 minutes): "For Loops - tsk tsk"

for (int i=0;i<b;++i)

for (int j=0;j<t;++j) { if (j==s-1) { a[tot%n]++; } tot++; } for (int i=0;i<n;++i) c[i] = a[i]; sort(a, a+n); int ans = 0; for (int i=0;i<n;++i) if (c[i]==a[n-2]) ans=i; printf("Data Set %d:\n%d\n\n", I, ans+1);

5 correct solutions
7 incorrect solutions

Last solution submitted on Sep 21, 2013