목록Solution (295)
개발자 뺚
Example: If a system of linear equations in x₁ and x₂ is: 2x₁ + x₂ = 2 x₁ - 4 x₂ = 3 Then the coefficient matrix (A) is: 2 1 1 -4 And the constant vector (b) is: 2 3 To solve this system, use mldivide ( \ ): x = A\b Problem: Given a constant input angle θ (theta) in radians, create the coefficient matrix (A) and constant vector (b) to solve the given system of linear equations in x₁ and x₂. cos(..
Given two input vectors: name - user last names age - corresponding age of the person Return the name of the oldest person in the output variable old_name. function old_name = find_max_age(name,age) [value index] = max(age); old_name = name(index); end
If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,...N i.e. the expected value of one die. For example, the expected value of a 6-sided die is 3.5. Given N, simulate 1e8 N-sided dice rolls by creating a vector of 1e8 uniformly distributed random integers. Return the difference between the mean of this vector and the mea..
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