🔥Baekjoon start🔥

ariel·2021년 10월 29일
0

Baekjoon

목록 보기
1/14
post-thumbnail

2021-10-29

✍쪠와 함께 하루에 30분 이상 시작✨

💻 if문

1330

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		int a, b;
	      a = sc.nextInt();
	      b = sc.nextInt();
	      
		if(a > b) {
			System.out.println(">");
		} else if(a < b) {
			System.out.println("<");
		}else if(a == b) {
			System.out.println("==");
		}

	}
} 

9498

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		int i = sc.nextInt();
	    
		if(i>=90) {
			System.out.println("A");
		}else if(i>=80) {
			System.out.println("B");
		}else if(i>=70) {
			System.out.println("C");
		}else if(i>=60) {
			System.out.println("D");
		}else {
			System.out.println("F");
		}

	}
} 

2753

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		int i = sc.nextInt();
	    
		if((i % 4 == 0 && i % 100 != 0) || (i % 400 == 0)) {
			System.out.println("1");
		}
		 else {
			System.out.println("0");
		}	
	}
} 

14681

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		int x, y;
		 x = sc.nextInt();
		 y = sc.nextInt();
		
		
		if(x>0 & y>0) {
			System.out.println("1");
		}
		if(x>0 & y<0) {
			System.out.println("4");
		}
		if(x<0 & y<0) {
			System.out.println("3");
		}
		if(x<0 & y>0) {
			System.out.println("2");
		}
	}
} 

2884

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 
		int h, m;
		 h = sc.nextInt();
		 m = sc.nextInt();
		
		if (m < 45) {
			h--;
			m = 60 - (45 -m);
			if(h<0) {
				h=23;
			}
			System.out.println(h +" "+ m);
		} else {
			m = m - 45;
			System.out.println(h +" "+ m);
		}
	}
} 

0개의 댓글