|
@@ -12,24 +12,51 @@ namespace Exam
|
|
|
public bool isDefective, isReinforced;
|
|
|
}
|
|
|
|
|
|
- Tubes[] tube = new Tubes[0];
|
|
|
-
|
|
|
static void Main(string[] args)
|
|
|
{
|
|
|
Tubes[] tube = new Tubes[0];
|
|
|
- tube = ReadData.Read("data.txt", ref tube);
|
|
|
+ tube = ReadData.Read("data.txt", tube);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- double[] diameters = new double[] { 20, 25, 32, 40, 50, 63 };
|
|
|
+ double[] diameters = new double[] { 20.000, 25.000, 32.000, 40.000, 50.000, 63.000 };
|
|
|
|
|
|
for (int i = 0; i < tube.Length; i++)
|
|
|
{
|
|
|
- if (!(3960 <= tube[i].length && tube[i].length >= 4040))
|
|
|
+ if (!(3960 <= tube[i].length && tube[i].length <= 4040))
|
|
|
{
|
|
|
tube[i].isDefective = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ double startRange, endRange;
|
|
|
+ for (int i = 0; i < tube.Length; i++)
|
|
|
+ {
|
|
|
+ bool check = true;
|
|
|
+ if (!tube[i].isDefective)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < diameters.Length; j++)
|
|
|
+ {
|
|
|
+ startRange = diameters[j] - (diameters[j] / 100.0);
|
|
|
+ endRange = diameters[j] + (diameters[j] / 100.0);
|
|
|
+ if (!(startRange <= tube[i].diameter && tube[i].diameter <= endRange))
|
|
|
+ {
|
|
|
+ check = false;
|
|
|
+ Console.WriteLine(i + 1 + " " + startRange + " " + endRange);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ check = true;
|
|
|
+ Console.WriteLine(i + 1 + " " + startRange + " " + endRange);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!check)
|
|
|
+ {
|
|
|
+ tube[i].isDefective = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|