Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- * Read input from System.in
- * Use System.out.println to ouput your result.
- * Use:
- * IsoContestBase.localEcho( variable)
- * to display variable in a dedicated area.
- * **/
- package com.isograd.exercise;
- import java.util.;
- public class IsoContest {
- public static void main( String[] argv ) throws Exception {
- String line;
- double t,d;
- String[] content;
- Scanner sc = new Scanner(System.in);
- while(sc.hasNextLine()) {
- line = sc.nextLine();
- content = line.split(" ");
- t = Double.valueOf(content[0]);
- d = Double.valueOf(content[1]);
- System.out.println(String.format("%.2f",getPercentage(100,t,d)));
- /Read the input here and perform the calculations/
- }
- /You can also perform the calculations once you have read all the data./
- }
- public static double getPercentage(double current, double t, double d) {
- if (d == 0) {
- return current-100;
- }
- return getPercentage(current + t/100*current, t, d -1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement