# 1053 : 참 거짓 바꾸기
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if(a==1) {
System.out.println("0");
}
else {
System.out.println("1");
}
sc.close();
}
}
# 1054 : 둘 다 참일 경우만 참 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a*b==1) {
System.out.println("1");
}
else {
System.out.println("0");
}
sc.close();
}
}
# 1055 : 하나라도 참이면 참 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = a + b;
if(c==0) {
System.out.println("0");
}
else {
System.out.println("1");
}
sc.close();
}
}
# 1056 : 참/거짓이 서로 다를 때에만 참 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a!=b) {
System.out.println("1");
}
else {
System.out.println("0");
}
sc.close();
}
}
# 1057 : 참/거짓이 서로 같을 때에만 참 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a==b) {
System.out.println("1");
}
else {
System.out.println("0");
}
sc.close();
}
}
# 1058 : 둘 다 거짓일 경우만 참 출력
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = a + b;
if(c==0) {
System.out.println("1");
}
else {
System.out.println("0");
}
sc.close();
}
}
CodeUp
☆ 파이썬 다운로드 : 파이썬3 ☆ 무료 C언어 IDE : Code::blocks DEV C++ ☆ 추천 온라인 IDE : C C++11 Python3 Java ☆ 채점 가능 언어 : C, C++, JAVA, Python 3.5 ★ C++로 제출시 void main()을 사용하면
codeup.kr
'CodeUp > Java' 카테고리의 다른 글
[CodeUp] 1063-1064 (Java) (0) | 2022.11.02 |
---|---|
[CodeUp] 1059-1062 (Java) (0) | 2022.11.01 |
[CodeUp] 1049-1052 (Java) (0) | 2022.10.30 |
[CodeUp] 1047-1048 (Java) (0) | 2022.10.29 |
[CodeUp] 1038-1046 (Java) (0) | 2022.10.28 |