Posts

URI Problem 1035 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 10, 2016 * @Time : 12:41:48 AM */ public class Uri1035 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a, b, c, d; a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); d = sc.nextInt(); if (compareTo(b, c) && compareTo(d, a) && compareTo(sum(c, d), sum(a, b)) && checkPositive(c) && checkPositive(d) && checkEven(a)) { System.out.println("Valores aceitos"); } else { System.out.println("Valores nao aceitos"); } } /** * * @param x given value * @param y compare value * @return true or false */ private static boolean compareTo(int x, int y) { return x ...

URI Problem 1021 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; import java.text.DecimalFormat; import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 9, 2016 * @Time : 5:42:42 PM */ public class Uri1021 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double n = sc.nextDouble(); if (n >= 0 && n

URI Problem 1020 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 8, 2016 * @Time : 10:45:35 PM */ public class Uri1020 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int years = n/365; int months = n%365; int days = months%30; months = months/30; System.out.println(years+" ano(s)\n"+months+" mes(es)\n"+days+" dia(s)"); } }

URI Problem 1019 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 8, 2016 * @Time : 10:23:50 PM */ public class Uri1019 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = 60; int minute = n / x; int second = n % x; int hour = minute / x; minute = minute % x; System.out.println(hour + ":" + minute + ":" + second); } }

URI Problem 1018 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 8, 2016 * @Time : 8:28:02 PM */ public class Uri1018 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n > 0 && n < 1000000){ int values[] = {100,50,20,10,5,2,1}; System.out.println(n); for (int i = 0; i < values.length; i++) { System.out.println(n/ values[i]+" nota(s) de R$ "+values[i]+",00"); n = n % values[i]; } } } }

URI Problem 1017 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 8, 2016 * @Time : 8:06:03 PM */ public class Uri1017 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int s_time,distance; s_time = sc.nextInt(); distance = sc.nextInt(); double cost = (double)(distance/12.0)*s_time; System.out.printf("%.3f\n",cost); } }

URI Problem 1016 Solution in Java

Problem Details  Link Solution: import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @E-mail : md.parvez28@gmail.com * @Date : Oct 8, 2016 * @Time : 7:58:58 PM */ public class Uri1016 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); System.out.println(2*x+" minutos"); } }