by Muhammad Harun-Or-Roshid | Jan 29, 2019 | Problem Solving, URI
URI Problem (Time Conversion) 1019:
Time Conversion a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @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);
}
}
by Muhammad Harun-Or-Roshid | Jan 29, 2019 | Problem Solving, URI
URI Problem (Banknotes) 1018:
Banknotes a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @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];
}
}
}
}
by Muhammad Harun-Or-Roshid | Jan 29, 2019 | Problem Solving, URI
URI Problem (Fuel Spent) 1017:
Fuel Spentis a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @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);
}
}
by Muhammad Harun-Or-Roshid | Jan 29, 2019 | Problem Solving, URI
URI Problem (Distance) 1016:
Distance is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @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");
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, UVa
UVa Problem (Train Swapping) 299:
Train Swapping is a basic problem on UVa online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 9:24:33 PM
*/
public class UVa299 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testCase = sc.nextInt();
for (int i = 0; i < testCase; i++) {
int inputLines = sc.nextInt();
if (inputLines >= 0 && inputLines <= 50) {
int inputArrays[] = new int[inputLines];
for (int j = 0; j < inputLines; j++) {
inputArrays[j] = sc.nextInt();
}
int swipTimes = 0;
for (int l = 0; l < inputArrays.length; l++) {
for (int k = 0; k < inputArrays.length - 1; k++) {
int a = inputArrays[k];
int b = inputArrays[k + 1];
if (a > b) {
inputArrays[k] = b;
inputArrays[k + 1] = a;
swipTimes++;
}
}
}
System.out.printf("Optimal train swapping takes %d swaps.\n", swipTimes);
}
}
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, URI
URI Problem (Distance Between Two Points) 1015:
Distance Between Two Points is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 9:24:33 PM
*/
public class Uri1015 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double x1,y1,x2,y2;
x1 = sc.nextDouble();
y1 = sc.nextDouble();
x2 = sc.nextDouble();
y2 = sc.nextDouble();
double distence = Math.sqrt(Math.pow(x2-x1, 2)+Math.pow(y2-y1, 2));
System.out.printf("%.4f\n",distence);
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, URI
URI Problem (Consumption) 1014:
Consumption is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 9:16:40 PM
*/
public class Uri1014 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
double Y = sc.nextDouble();
double Z = X/Y;
System.out.printf("%.3f km/l\n",Z);
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, URI
URI Problem (The Greatest) 1013:
The Greatest is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 8:55:55 PM
*/
public class Uri1013 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A, B, C;
A = sc.nextInt();
B = sc.nextInt();
C = sc.nextInt();
int d = maior(maior(A, B), C);
System.out.println(d + " eh o maior");
}
private static int maior(int A, int B) {
return (A + B + Math.abs(A - B)) / 2;
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, URI
URI Problem (Area) 1012:
Area is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 8:38:17 PM
*/
public class Uri1012 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double A,B,C;
A = sc.nextDouble();
B = sc.nextDouble();
C = sc.nextDouble();
//a) the area of the rectangled triangle that has base A and height C.
double area_triangle = 0.5f*A*C;
//b) the area of the radius's circle C. (pi = 3.14159)
double area_radius = 3.14159*C*C;
//c) the area of the trapezium which has A and B by base, and C by height.
double area_trapezium = ((A+B)/2)*C;
//d) the area of the square that has side B.
double area_square = B*B;
//e) the area of the rectangle that has sides A and B.
double area_rectangle = A*B;
System.out.printf("TRIANGULO: %.3f\n",area_triangle);
System.out.printf("CIRCULO: %.3f\n",area_radius);
System.out.printf("TRAPEZIO: %.3f\n",area_trapezium);
System.out.printf("QUADRADO: %.3f\n",area_square);
System.out.printf("RETANGULO: %.3f\n",area_rectangle);
}
}
by Muhammad Harun-Or-Roshid | Jan 28, 2019 | Problem Solving, URI
URI Problem (Sphere) 1011:
Sphere is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 6, 2016
* @Time : 8:31:10 PM
*/
public class Uri1011 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double R = sc.nextDouble();
double VOLUME = (4.0/3.0)*3.14159*R*R*R;
System.out.printf("VOLUME = %.3f\n",VOLUME);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Simple Calculate) 1010:
Simple Calculate is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 9:39:55 PM
*/
public class Uri1010 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int c_1_p, c_2_p, n_1_p, n_2_p;
double v_1_p, v_2_p, total;
c_1_p = sc.nextInt();// code of product
n_1_p = sc.nextInt();// units of product
v_1_p = sc.nextDouble();// price for one unit of product
c_2_p = sc.nextInt();// code of product
n_2_p = sc.nextInt();// units of product
v_2_p = sc.nextDouble();// price for one unit of product
total = (n_1_p * v_1_p) + (n_2_p * v_2_p); // total price of products
System.out.printf("VALOR A PAGAR: R$ %.2f\n", total);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Salary with Bonus) 1009:
Salary with Bonus is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 9:17:11 PM
*/
public class Uri1009 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name;
double f_salary,t_sell,bonus,t_salary;
name = sc.next();
f_salary = sc.nextDouble();
t_sell = sc.nextDouble();
bonus = (t_sell*15)/100;
t_salary = f_salary+bonus;
System.out.printf("TOTAL = R$ %.2f\n",t_salary);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Salary) 1008:
Salary is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 9:08:55 PM
*/
public class Uri1008 {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int n,h;
double m,salary;
n = sc.nextInt();
h = sc.nextInt();
m = sc.nextDouble();
salary = h*m;
System.out.println("NUMBER = "+n);
System.out.printf("SALARY = U$ %.2f\n",salary);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Difference) 1007:
Difference is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 9:03:50 PM
*/
public class Uri1007 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A,B,C,D,DIFERENCA;
A = sc.nextInt();
B = sc.nextInt();
C = sc.nextInt();
D = sc.nextInt();
DIFERENCA = (A*B)-(C*D);
System.out.println("DIFERENCA = "+DIFERENCA);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Average 2) 1006:
Average 2 is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @E-mail : [email protected]
* @Date : Oct 5, 2016
* @Time : 8:58:41 PM
*/
public class Uri1006 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double A,B,C;
A = sc.nextDouble();
B = sc.nextDouble();
C = sc.nextDouble();
double MEDIA = (A*2+B*3+C*5)/(2+3+5);
System.out.printf("MEDIA = %.1f\n",MEDIA);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Average 1) 1005:
Average 1 is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 8:35:11 PM
*/
public class Uri1005 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double A=sc.nextDouble();
double B =sc.nextDouble();
double MEDIA = (A*3.5+B*7.5)/(3.5+7.5);
System.out.printf("MEDIA = %.5f\n",MEDIA);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Simple Product) 1004:
Simple Product is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 8:27:43 PM
*/
public class Uri1004 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
int PROD = X*Y;
System.out.println("PROD = "+PROD);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Simple Sum) 1003:
Simple Sum is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 8:22:41 PM
*/
public class Uri1003 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A= sc.nextInt();
int B= sc.nextInt();
int SOMA = A+B;
System.out.println("SOMA = "+SOMA);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Area of a Circle) 1002:
Area of a Circle is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 5, 2016
* @Time : 7:52:48 PM
*/
public class Uri1002 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double R = sc.nextDouble();
double A = (3.14159*R*R);
System.out.printf("A=%.4f\n",A);
}
}
by Muhammad Harun-Or-Roshid | Jan 27, 2019 | Problem Solving, URI
URI Problem (Extremely Basic) 1001:
Extremely Basic is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner;
/**
* @Author : Muhammad Harun-Or-Roshid
* @Date : Oct 4, 2016
* @Time : 7:52:48 PM
*/
public class Uri1001 {
public static void main(String []args){
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int X = A+B;
System.out.println("X = "+X);
}
}