분류 전체보기 (15) 썸네일형 리스트형 [c] 삼각형과 세 변(5073) 문제삼각형의 세 변의 길이가 주어질 때 변의 길이에 따라 다음과 같이 정의한다.Equilateral : 세 변의 길이가 모두 같은 경우Isosceles : 두 변의 길이만 같은 경우Scalene : 세 변의 길이가 모두 다른 경우단 주어진 세 변의 길이가 삼각형의 조건을 만족하지 못하는 경우에는 "Invalid" 를 출력한다. 예를 들어 6, 3, 2가 이 경우에 해당한다. 가장 긴 변의 길이보다 나머지 두 변의 길이의 합이 길지 않으면 삼각형의 조건을 만족하지 못한다.세 변의 길이가 주어질 때 위 정의에 따른 결과를 출력하시오. 입력각 줄에는 1,000을 넘지 않는 양의 정수 3개가 입력된다. 마지막 줄은 0 0 0이며 이 줄은 계산하지 않는다.출력각 입력에 맞는 결과 (Equilateral, Iso.. [명품자바] 오픈 챌린지 6 import java.util.*;public class histo { String readString() { StringBuffer sb = new StringBuffer(); Scanner scanner = new Scanner(System.in); while(true) { String line = scanner.nextLine(); if(line.equals(";")) break; sb.append(line); } scanner.close(); return sb.toString(); } int[] getCount (String input) { int count[] = new int[26]; for (int i = 0; i [명품자바] 오픈 챌린지 5 import java.util.Scanner;public abstract class GameObject { protected int distance; protected int x, y; public GameObject(int startX, int startY, int distance) { this.x = startX; this.y = startY; this.distance = distance; } public int getX() { return x; } public int getY() { return y; } public boolean collide(GameObject p) { if(this.x == p.getX() && this.y == p.getY()) return true; el.. [명품자바] 오픈 챌린지 4 import java.util.Scanner;public class WorldGameApp { public void run() { Scanner scan = new Scanner(System.in); System.out.println("끝말잇기를 시작합니다..."); System.out.print("게임에 참가하는 인원은 몇명입니까?>>"); int count = scan.nextInt(); scan.nextLine(); Player p[] = new Player[count]; for (int i = 0; i >"); p[i] = new Player(scan.nextLine()); } System.out.println("시작하는 단어는 아버지입니다."); p[(p.le.. [명품자바] 오픈 챌린지 3 import java.util.Scanner;import java.util.Random;public class OpenChallenge3 { public OpenChallenge3() { Scanner scan = new Scanner(System.in); Random r = new Random(); while (true) { int correct = r.nextInt(100); // 0-99까지의 임의의 수 int input = -1; // 유저가 입력한 수 int i = 1; System.out.println("수를 결정하였습니다. 맞추어 보세요"); System.out.println("0-99"); // 유저가 답을 맞출때 까지 반복 while (.. [명품자바] 오픈 챌린지 10 import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Chapter10 extends JFrame{ public Chapter10() { setTitle("openChallenge 10"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.add(new GamePanel(), BorderLayout.CENTER); setSize(600, 400); setVisible(true); } static public void main(String [] args) { new Chapter10(); }}class .. [명품자바] 오픈 챌린지 9 import javax.swing.*;import java.awt.*;public class Chapter9 extends JFrame { public Chapter9() { setTitle("openChallenge 9"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.add(new NorthPanel(), BorderLayout.NORTH); c.add(new CenterPanel(), BorderLayout.CENTER); setSize(400, 500); setVisible(true); } static public void main(String [] args) { new.. [C] 10진수를 2진수 외에도 다양하게 변환해보자 https://forprog.tistory.com/8 [C]10진수를 2진수로 변환해보자 10진수를 2진수로 변환하는 방법은 10진수의 수를 2로 1이 나올때 까지 나눈 다음 1부터 나머지 순서대로 적어주면 된다. 위의 방법과 C언어를 이용해 0 이상의 정수인 10진수를 2진수로 변환 해보 forprog.tistory.com 저번 게시글에서는 10진수를 2진수로만 변환해봤다. 이번에는 2진수 외에도 16진수 까지 변환 해보자. 주의점 나머지 표현 나머지 표현 1 1 10 A 2 2 11 B 3 3 12 C 4 4 13 D 5 5 14 E 6 6 15 F 7 7 8 8 9 9 10진수를 다른 진법의 수로 변화하는 방법은 동일하다. 하지만 11진법 부터는 나머지가 10이상으로 나와 숫자로 표기할 수 없다. .. 이전 1 2 다음