Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PuzzleA
- {
- private const int CycleCount = 6;
- public static void Main(string[] args)
- {
- PuzzleB[] list = new PuzzleB[6];
- int y = 1;
- for (var i = 0; i < CycleCount; i++)
- {
- list[i] = new PuzzleB();
- list[i].value = y;
- y = y * 10;
- }
- int result = 0;
- for (int i = CycleCount; i > 0; i--)
- {
- int index = i - 1;
- PuzzleB element = list[index];
- result += element.Calculate(index);
- }
- Debug.Log("Result" + result);
- }
- }
- public class PuzzleB
- {
- public int value;
- private const int MaxValue = 100;
- public int Calculate(int factor)
- {
- if (value > MaxValue)
- {
- return value * factor;
- }
- else
- {
- return value * (5 - factor);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement