Simulation
Java\njava\npublic int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int hours = 0, currentEnergy = init
##### Java\n```java\npublic int minNumberOfHours(int initialEnergy, int initialExperience, int[] energy, int[] experience) {\n        int hours = 0, currentEnergy = initialEnergy, currentExperience = initialExperience;\n\n        for (int opponent = 0; opponent < energy.length; opponent++) {\n            if (energy[opponent] >= currentEnergy) {\n                int energyDifference = energy[opponent] - currentEnergy;\n                hours += energyDifference + 1;\n                currentEnergy += energyDifference + 1;\n            }\n            \n            if (experience[opponent] >= currentExperience) {\n                int experienceDifference = experience[opponent] - currentExperience;\n                hours += experienceDifference + 1;\n                currentExperience += experienceDifference + 1;\n            }\n            \n            currentEnergy -= energy[opponent];\n            currentExperience += experience[opponent];\n        }\n\n        return hours;\n    }\n```\n\n##### C++\n```c++\npublic:\n    int minNumberOfHours(int initialEnergy, int initialExperience, vector<int>& energy, vector<int>& experience) {\n        int hours = 0, currentEnergy = initialEnergy, currentExperience = initialExperience;\n\n        for (int opponent = 0; opponent < energy.size(); opponent++) {\n            if (energy[opponent] >= currentEnergy) {\n                int energyDifference = energy[opponent] - currentEnergy;\n                hours += energyDifference + 1;\n                currentEnergy += energyDifference + 1;\n            }\n\n            if (experience[opponent] >= currentExperience) {\n                int experienceDifference = experience[opponent] - currentExperience;\n                hours += experienceDifference + 1;\n                currentExperience += experienceDifference + 1;\n            }\n\n            currentEnergy -= energy[opponent];\n            currentExperience += experience[opponent];\n        }\n\n        return hours;\n    }\n```
['C', 'Java']