You are viewing a single comment's thread. Return to all comments →
A slightly different approach:
import java.util.Scanner; class Solution { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int day = scnr.nextInt(); int liked = 5/2, cumulative = 2; for(int i=1; i<day; i++) { liked = (liked * 3)/2; cumulative += liked; } System.out.print(cumulative); } }
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 →
A slightly different approach: