목록전체 글 (319)
개발자 뺚
Given an input vector F containing temperature values in Fahrenheit, return an output vector C that contains the values in Celsius using the formula: C = (F–32) * 5/9 function C = temp_convert(F) C = (F - 32) * 5 / 9 end
시간 제한 : 1 초 메모리 제한 : 128 MB 문제 어떤 사람의 C언어 성적이 주어졌을 때, 평점은 몇 점인지 출력하는 프로그램을 작성하시오. A+: 4.3, A0: 4.0, A-: 3.7 B+: 3.3, B0: 3.0, B-: 2.7 C+: 2.3, C0: 2.0, C-: 1.7 D+: 1.3, D0: 1.0, D-: 0.7 F: 0.0 입력 첫째 줄에 C언어 성적이 주어진다. 성적은 문제에서 설명한 13가지 중 하나이다. 출력 첫째 줄에 C언어 평점을 출력한다. #include #include char arr[3]; int main() { scanf(" %s", &arr); if (strcmp(arr, "A+") == 0) printf("4.3"); else if (strcmp(arr, "A0")..
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1 function y = your_fcn_name(x) des_x = sort(x, 'descend') if isequal(x, des_x) y = 1 else y = 0 end end
Given two input variables r and h, which stand for the radius and height of a cake, calculate the surface area of the cake you need to put frosting on (all around the sides and the top). Return the result in output variable SA. function SA = func_frosting(r,h) SA = pi * r ^ 2 + 2 * pi * r * h; end
Given two lists of numbers, determine the weighted average as follows Example [1 2 3] and [10 15 20] should result in 33.3333 (1*10 + 2*15 + 3*20)/3 function y = weighted_average(x,w) [row, col] = size(x); sum = 0; for i = 1:col sum = sum + x(i) * w(i); end y = sum / col; end
Assuming a simple diatonic C scale, calculate the interval (integer) between two notes (provided as strings). By applying numbers to the notes of the scale (C,D,E,F,G,A,B,C = 1,2,3,4,5,6,7,8), intervals can be calculated. Because a unison is defined as one rather than zero, you add one to the numerical difference. The intervals are defined as: C - C: perfect unison, 1 C - D: major second, 2 C - ..
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples: Input x = 2 Output y is 4 Input x = 17 Output y is 34 function y = times2(x) y = 2 * x; end
시간 제한 : 1 초 메모리 제한 : 128 MB 문제 연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서 100의 배수가 아니라서 윤년이다. 1900년은 100의 배수이고 400의 배수는 아니기 때문에 윤년이 아니다. 하지만, 2000년은 400의 배수이기 때문에 윤년이다. 입력 첫째 줄에 연도가 주어진다. 연도는 1보다 크거나 같고, 4000보다 작거나 같은 자연수이다. 출력 첫째 줄에 윤년이면 1, 아니면 0을 출력한다. #include int main() { int a = 0; while (a 4000) scanf("%d"..