Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.omg.CORBA.MARSHAL;
- import org.omg.Messaging.SYNC_WITH_TRANSPORT;
- import java.lang.reflect.Array;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner=new Scanner (System.in);
- long population=Long.parseLong(scanner.nextLine());
- int periodYears=Integer.parseInt(scanner.nextLine());
- int bornPer120Second= Integer.parseInt(scanner.nextLine());
- int deathPer100Second=Integer.parseInt(scanner.nextLine());
- int emigrantPer40Second=Integer.parseInt(scanner.nextLine());
- double bornPerSecond=bornPer120Second/120;
- double deathPerSecond=deathPer100Second/100;
- double emigrantPerSecond=emigrantPer40Second/40;
- double diffPerSecond=(bornPerSecond+emigrantPerSecond)-deathPerSecond;
- if(diffPerSecond>0){
- double diff=(diffPerSecond*60*60*24*365)*periodYears;
- population+=diff;
- System.out.println(population);
- }else {
- double diff=(diffPerSecond*60*60*24*365)*periodYears;
- population-=diff;
- System.out.println(population);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment