목록c++ (345)
코딩로그

[문제] At sea level, atmospheric pressure is 100 kPa and water begins to boil at 100◦C. As you go above sea level, atmospheric pressure decreases, and water boils at lower temperatures. As you go below sea level, atmospheric pressure increases, and water boils at higher temperatures. A formula relating atmospheric pressure to the temperature at which water begins to boil is P = 5 × B − 400 where P..

[문제] In many introductory computer programming classes, the first program that students learn to write just prints “Hello, world!” It is used as a first assignment because it is a simple program that produces output. The program dates back to at least 1974, when Brian Kernighan used it as an example in a C programming tutorial. Its popularity has grown since then. Louisiana Tech University's ACM..

[문제] Barley the dog loves treats. At the end of the day he is either happy or sad depending on the number and size of treats he receives throughout the day. The treats come in three sizes: small, medium, and large. His happiness score can be measured using the following formula: 1 × S + 2 × M + 3 × L where S is the number of small treats, M is the number of medium treats and L is the number of l..

[문제] You record all of the scoring activity at a basketball game. Points are scored by a 3-point shot, a 2-point field goal, or a 1-point free throw. You know the number of each of these types of scoring for the two teams: the Apples and the Bananas. Your job is to determine which team won, or if the game ended in a tie. [입력] The first three lines of input describe the scoring of the Apples, and..

[문제] 4 × 3 = 12이다. 이 식을 통해 다음과 같은 사실을 알 수 있다. 3은 12의 약수이고, 12는 3의 배수이다. 4도 12의 약수이고, 12는 4의 배수이다. 두 수가 주어졌을 때, 다음 3가지 중 어떤 관계인지 구하는 프로그램을 작성하시오. 첫 번째 숫자가 두 번째 숫자의 약수이다. 첫 번째 숫자가 두 번째 숫자의 배수이다. 첫 번째 숫자가 두 번째 숫자의 약수와 배수 모두 아니다. [입력] 입력은 여러 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 10,000이 넘지않는 두 자연수로 이루어져 있다. 마지막 줄에는 0이 2개 주어진다. 두 수가 같은 경우는 없다. [출력] 각 테스트 케이스마다 첫 번째 숫자가 두 번째 숫자의 약수라면 factor를, 배수라면 multiple을, 둘..

[문제] 다음의 점화식에 의해 정해지는 수열 C(n)을 생각하자: C(n+1) = C(n)/2 (C(n)이 짝수일 때) = 3*C(n)+1 (C(n)이 홀수일 때) 초항 C(1)이 자연수로 주어지면, 이 점화식은 자연수로 이루어지는 수열을 정한다. 예를 들어, C(1)=26이면, 다음의 수열이 된다. 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, ... 이 경우, 수열의 뒷부분은 4, 2, 1 이 끝없이 반복된다. 실제로 C(1)이 5×260보다 작은 자연수인 모든 수열은 언젠가는 4, 2, 1로 끝나게 된다는 것이 알려져 있다. 주어진 입력 C(1)에 대하여 C(n)이 처음으로 1이 되는 n을 출력하시오. [입력] C(1); 1 ≤ C(1) ≤ 1..

[문제] 수학자가 구를 깎아서 볼록다면체를 만들었다. 이 수학자는 임의의 볼록다면체에 대해 (꼭짓점의 수) - (모서리의 수) + (면의 수) = 2가 성립한다는 것을 알고 있다. 그래서 구를 깎는 게 취미인 이 사람은 꼭짓점, 모서리와 면의 수를 기록할 때 꼭짓점과 모서리의 수만 세고 면의 수는 세지 않는다. [입력] 첫 번째 줄에 1 이상 100 이하의 자연수 T가 주어진다. 다음 T개의 줄에 4 이상 100 이하의 자연수 V와 E가 공백을 사이에 두고 주어진다. V와 E는 각각 꼭짓점의 개수와 모서리의 개수이다. [출력] 각 V와 E에 대해 볼록다면체의 면의 수를 한 줄에 하나씩 출력한다. [Source Code] #include #include #include #include #include us..

[문제] 코이 초등학교에 새로 부임하신 교장 선생님은 어린 학생들의 행복감과 학생들의 성적 차이 관계를 알아보기로 했다. 그래서 이전 성적을 조사하여 학생 들의 시험 점수 차이 변화를 알아보려고 한다. 예를 들어서 2016년 학생 8명의 점수가 다음과 같다고 하자. 27, 35, 92, 75, 42, 53, 29, 87 그러면 가장 높은 점수는 92점이고 가장 낮은 점수는 27점이므로 점수의 최대 차이는 65이다. 한편 2017년 학생 8명의 점수가 다음과 같았다. 85, 42, 79, 95, 37, 11, 72, 32 이때 가장 높은 점수는 95점이고 가장 낮은 점수는 11점이므로 점수의 최대 차이는 84이다. N명 학생들의 점수가 주어졌을 때, 가장 높은 점수와 가장 낮은 점수의 차이를 구하는 프로그..