Monday, March 11, 2013

TechGig: The Great Indian Programming League 2013 - Jan Edition


Fashion Contest 2013


My Score: 99.99 
Test Cases Passed: 8

import java.io.*;
  1. public class CandidateCode
  2. {
  3. public static int fashion(int[] input1)
  4. {
  5. //Write code here
  6. int totalJudges = input1.length;
  7. if(totalJudges==0)
  8. return 0;
  9. else if(totalJudges==1)
  10. return input1[0];
  11. else
  12. {
  13. int centerJudge = (totalJudges+1)/2-1;
  14. int centerJudgeScore = input1[centerJudge];
  15. for(int i=0,j=1;i
  16. {
  17. if(input1[centerJudge-j]==input1[centerJudge+j])
  18. centerJudgeScore+=input1[centerJudge+j];
  19. }
  20. return centerJudgeScore;
  21. }
  22. }
  23. }

0 comments: