본문 바로가기

전체 글

13주차 계산과학 수업 내용 대충 https://www.youtube.com/watch?v=j48LtUkZRjU&list=PLPV2KyIb3jR53Jce9hP7G5xC4O9AgnOuL OnClick() 으로 버튼을 눌렀을 때 어떤 작동을 할 것인지 지정해주는 것을 배웠다. Loading.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; public class Loading : Scene { #region INSPECTOR public TMP_Text text; #endregion public override eScene GetSceneType() => eScene.Loading; .. 더보기
겹치지 않는 3개의 메뉴 return 1.returnMenu.dart //returnMenu //랜덤하게 겹치지 않는 세개의 메뉴 리턴 List returnMenu(List menuList, List cannotEat, budget, howMAnyPeople, hateCategory){ var menuLength = menuList.length; var dump = MenuClass("dump", 1, 1, 1, []); var returnList = [dump, dump, dump]; var cnt = 0; while(cnt 더보기
숨어있는 숫자의 덧셈 solution code Solution 1 아 문제를 아예 잘못읽고 삽질했다. def solution(my_string: String): Int = { val str = my_string.sorted def filter(idx:Int=0, res:String =""):String={ if(idx==my_string.length) res else{ if(str(idx).toInt>57) str.slice(0,idx) else filter(idx+1,res) } } val lst:List[Char] = filter().toList def sum(idx:Int=0, count:Int = 0):Int={ if(idx==lst.length) count else sum(idx+1, count-48+lst(idx).toInt) } sum(.. 더보기
다항식 더하기 solution code Solution 1) def solution(polynomial: String): String = { val arr:Array[String] = polynomial.split(" ") val num:Int = arr.length def x_list(idx:Int=0, lst:List[String]=List()):List[String]={ if(idx==num) lst else{ if((arr(idx).length>1)&&(arr(idx)(1).toString=="x")) x_list(idx+1,lst:::List(arr(idx)(0).toString)) else if (arr(idx)=="x") x_list(idx+1, lst:::List("1")) else x_list(idx+1,lst) } } def.. 더보기
프로그래머스 한 번만 등장한 문자 solution code Solution 1. object Solution { def solution(s: String): String = { val sorted_str: String = s.sorted + "1" def func(idx: Int, res: String = ""): String = { if (idx >= s.length) res else { if (sorted_str(idx) == sorted_str(idx + 1)) func(idx + 2, res) else if ((idx!=0)&&(sorted_str(idx) == sorted_str(idx - 1))) func(idx + 2, res) else func(idx + 1, res + sorted_str(idx)) } } func(0) } } 첫번째 코드는 테스.. 더보기
sinusoidal steady-stage analysis Direct Current Circuit Alternaiong current Circuit 1. DC circuit & AC circuit의 차이 2. Phasors Time domain(직교좌표) --> Frequency domain(극좌표) 영역으로 옮겨서 표현하면 계산이 간단해짐. 푸리에 변환에 의해서 임의의 신호를 복소 지수 함수의 합 형태로 표현하는게 가능하기 때문에 복소평면에서 표현하는 것이 편하다. 3. Impedance 임피던스는 AC회로에서 저항이다. AC회로에서 옴의 법칙이 적용되는데, DC회로와의 차이가 있다. DC 회로는 time domain이지만, AC 회로에서는 frequency domain이라는 점이다. 4. 복소수의 의미 DC회로에서는 실수부분만 존재하닥 AC회로에서 허수가 .. 더보기
HW3 -(4) StackedArray 구현하기 final class StackedArray(val values: Array[NDArray]) extends NDArray { val ndim: Int = this.getShape.length val getShape: Array[Int] = { def func(res: Array[Int] = Array(), x: Array[NDArray]): Array[Int] = { if (x(0).ndim == 1) res ++ Array(x.length) ++ Array(x(0).values.length) else func(res ++ Array(x.length), x(0).values) } func(this.values) } def getArr(i: Int): NDArray = { if (i >= values.l.. 더보기
Scala 다차원 배열 및 초기화 2차원 배열 혹은, 특정한 값으로 차있는 배열을 만들고자 하면 다음과 같이 사용. 결국에는 아래 두개의 문장은 같은 결과를 내보인다. val sth1 = Array.fill(2,3)(false) 결과 ) Array[Array[Boolean]] = Array(Array(false,false,false),Array(false,false,false)) val sth2 = Array.ofDim[Boolean](3,3) 결과 ) Array[Array[Boolean]] = Array(Array(false, false, false), Array(false, false, false), Array(false, false, false)) 캐스팅하기, 특정 타입인지 검사하기 Java에서는 캐스팅할 때 C와 같은 문법을 쓰는.. 더보기