큐범
Just do debug
큐범
전체 방문자
오늘
어제
  • 전체보기 (128)
    • 회고 (4)
    • JAVA (16)
      • JAVA 기초 (18)
      • JAVA Algorithm, Datastruct (13)
    • Spring (11)
    • Micro Service Architecture (3)
    • JPA (6)
    • gRPC (4)
    • Network (8)
    • Process (7)
    • Cloud (4)
    • Python (10)
    • Web(vue) (2)
    • UMC (1)
    • DB (9)
    • CS (1)
    • Clean Code (1)
    • TDD (9)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

인기 글

최근 댓글

최근 글

hELLO · Designed By 정상우.
큐범

Just do debug

JAVA/JAVA Algorithm, Datastruct

[Algorithm] JAVA 코드업 기초 100제 (기초-논리연산) 1053 ~ 1058

2022. 9. 1. 19:56

1053 : [기초-논리연산] 참 거짓 바꾸기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		
		if(i == 1) {
			System.out.println(0);
		}else {
			System.out.println(1);
		}		
	}

1054 : [기초-논리연산] 둘 다 참일 경우만 참 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		if(1==Integer.parseInt(s.substring(s.indexOf(" ")+1)) && 1==Integer.parseInt(s.substring(s.indexOf(0)+1, s.indexOf(" ")))) {
			System.out.println("1");
		}else {
			System.out.println("0");
		}
	}

1055 : [기초-논리연산] 하나라도 참이면 참 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		if(1==Integer.parseInt(s.substring(s.indexOf(" ")+1)) || 1==Integer.parseInt(s.substring(s.indexOf(0)+1, s.indexOf(" ")))) {
			System.out.println("1");
		}else {
			System.out.println("0");
		}
	}

1056 : [기초-논리연산] 참/거짓이 서로 다를 때에만 참 출력하기(설명)

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		int i1 = Integer.parseInt(s.substring(s.indexOf(" ")+1));
		int i2 = Integer.parseInt(s.substring(s.indexOf(0)+1, s.indexOf(" ")));
				
		if(i1 != i2) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}
	}

1057 : [기초-논리연산] 참/거짓이 서로 같을 때에만 참 출력하기

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		int i1 = Integer.parseInt(s.substring(s.indexOf(" ")+1));
		int i2 = Integer.parseInt(s.substring(s.indexOf(0)+1, s.indexOf(" ")));
				
		if(i1 == i2) {
			System.out.println(1);
		}else {
			System.out.println(0);
		}
	}

1058 : [기초-논리연산] 둘 다 거짓일 경우만 참 출력하기

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		int i1 = Integer.parseInt(s.substring(s.indexOf(" ")+1));
		int i2 = Integer.parseInt(s.substring(s.indexOf(0)+1, s.indexOf(" ")));
				
		if(i1==0 && i2==0) {
			System.out.println(0);
		}else {
			System.out.println(1);
		}
	}
    'JAVA/JAVA Algorithm, Datastruct' 카테고리의 다른 글
    • [Algorithm] JAVA 코드업 기초 100제 (기초-삼항연산, 선택실행 구조) 1063 ~ 1070
    • [Algorithm] JAVA 코드업 기초 100제 (기초-비트단위논리연산) 1059 ~ 1062
    • [Algorithm] JAVA 코드업 기초 100제 (기초-비교연산) 1049 ~ 1052
    • [Algorithm] JAVA 코드업 기초 100제 (기초-비트시프트연산) 1047 ~ 1048
    큐범
    큐범

    티스토리툴바