You are viewing a single comment's thread. Return to all comments →
Simple Java solution:
public class Solution { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int num = keyboard.nextInt(); int people = 5; int sum = 0; for(int i = 0; i < num; i++){ people = (int) Math.floor(people/2); sum += people; people *= 3; } System.out.println(sum); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Viral Advertising
You are viewing a single comment's thread. Return to all comments →
Simple Java solution: