|
|
back to boardCommon Board1572. Yekaterinozavodsk Great Well Posted by Check 17 Aug 2011 20:03 Hey guys help me out please, what is the 3rd test? Here is my code: for (int i = 0; i < n; i++) { if (CoverType[i] == 1 && WellType == 1 && WellSize <= CoverSize[i]) { Number++; } else if (CoverType[i] == 2 && WellType == 1 && WellSize <= CoverSize[i]*Math.Sqrt(3)/6) { Number++; } else if (CoverType[i] == 3 && WellType == 1 && WellSize <= CoverSize[i]/2) { Number++; } else if (CoverType[i] == 1 && WellType == 2 && WellSize <= CoverSize[i]*Math.Sqrt(3)) { Number++; } else if (CoverType[i] == 2 && WellType == 2 && WellSize <= CoverSize[i]) { Number++; } else if (CoverType[i] == 3 && WellType == 2 && WellSize / Math.Sqrt(3) <= CoverSize[i] /2) { Number++; } else if (CoverType[i] == 1 && WellType == 3 && WellSize <= CoverSize[i]*Math.Sqrt(2)) { Number++; } else if (CoverType[i] == 2 && WellType == 3 && WellSize * Math.Sqrt(6) <= CoverSize[i]) { Number++; } else if (CoverType[i] == 3 && WellType == 3 && WellSize <= CoverSize[i]) { Number++; } } What is wrong with this code? Should it be <= or < when comparing sizes? |
|
|