Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ЛИЦЕ НА ТРИЪГЪЛНИК В РАВНИНА
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int x1 = Integer.parseInt(scan.nextLine());
- int y1 = Integer.parseInt(scan.nextLine());
- int x2 = Integer.parseInt(scan.nextLine());
- int y2 = Integer.parseInt(scan.nextLine());
- int x3 = Integer.parseInt(scan.nextLine());
- int y3=y2;
- int a = Math.abs(x2-x3);
- int h = Math.abs(y2-y1);
- double S = (double)a*h/2;
- System.out.println(S);
- }
- }
- ПРЕНАСЯНЕ НА ТУХЛИ
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int bricks = Integer.parseInt(scan.nextLine());
- int workers = Integer.parseInt(scan.nextLine());
- int comp = Integer.parseInt(scan.nextLine());
- int bricksPerWorker= bricks/workers;
- double courses = Math.ceil((double)bricksPerWorker/comp);
- if(courses == 0) {
- courses = 1;
- }
- System.out.printf("%.0f",courses);
- }
- }
- ТОЧКА ОТ ОТСЕЧКА
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int first = Integer.parseInt(scan.nextLine());
- int second = Integer.parseInt(scan.nextLine());
- int point = Integer.parseInt(scan.nextLine());
- int closest = Math.min(Math.abs(first - point),Math.abs(second - point));
- if(point<=first && point>=second) {
- System.out.println("in");
- }else {
- System.out.println("out");
- }
- System.out.println(closest);
- }
- }
- ТОЧКА ВЪВ ФИГУРА
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int x = Integer.parseInt(scan.nextLine());
- int y = Integer.parseInt(scan.nextLine());
- if((x>=4 && x<=10 && y>=-5 && y<=3) || (x>= 2 && x<= 12 && y>=-3 && y<=1)) {
- System.out.println("in");
- }else {
- System.out.println("out");
- }
- }
- }
- ДАТА СЛЕД 5 ДНИ
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int d = Integer.parseInt(scan.nextLine());
- int m = Integer.parseInt(scan.nextLine());
- int dayInMounts = 31;
- d+=5;
- if(m==4 || m==6 || m==9 || m==11) {
- dayInMounts = 30;
- }
- if(m==2) {
- dayInMounts = 28;
- }
- if(d>=dayInMounts) {
- d = d - dayInMounts;
- m+=1;
- }
- if(m>=12) {
- m=1;
- }
- System.out.printf("%d.%02d",d,m);
- }
- }
- СУМА ОТ ТРИ ЧИСЛА
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int a = Integer.parseInt(scan.nextLine());
- int b = Integer.parseInt(scan.nextLine());
- int c = Integer.parseInt(scan.nextLine());
- if (a + b == c) {
- if (a < b) {
- System.out.printf("%d + %d = %d", a, b, c);
- }if(a>b) {
- System.out.printf("%d + %d = %d", b, a, c);
- }
- }
- else if (a + c == b) {
- if (a < c) {
- System.out.printf("%d + %d = %d", a, c, b);
- }if(a>c) {
- System.out.printf("%d + %d = %d", c, a, b);
- }
- }
- else if (b + c == a) {
- if (b < c) {
- System.out.printf("%d + %d = %d", b, c, a);
- }if(b>c) {
- System.out.printf("%d + %d = %d", c, b, a);
- }
- }else {
- System.out.println("No");
- }
- }
- }
Add Comment
Please, Sign In to add comment