목록분류 전체보기 (91)
눈송이의 개발생활
1. 조건문 📌 if const name = 'df'; if (name === 'suah') { console.log('Welcome, Suah!'); } else if (name === 'coder') { console.log('You are amazing coder'); } else { console.log('unknown'); } 📌 ? condition ? value1 : value2 조건이 참이면 value1 출력 조건이 거짓이면 value2 출력 console.log(name === 'suah' ? 'yes' : 'no'); //no 📌 switch 여러개의 if문이..
1. Data Types 📌 let added in ES6 유일한 변수 선언 명령어 Muttable (read&write) //global scope let name = 'suah'; console.log(name); { //block scope let age = 23; console.log(age); } block scope : {} 블록 밖에서는 블록 안으로 접근할 수 없음 global scope : 전역 변수. application 시작부터 끝까지 메모리에 탑재되어있기 때문에 최대한 덜 쓰는 것이 좋음 📌 var 지금은 잘 사용하지 않는 변수 선언 명령어 선언하기 전에 값을 할당할 수 있음 var hoising : 어디에 변수를 선언했느냐에 상관없이 항상 제일 위로 선언을 끌어 올려주..
Layout은 무엇인가? view 위젯들 화면에 배치하는 과정에서 정렬, 그룹화 등의 역할 수행하는 클래스 Layout == ViewGroup view 포함하는 container의 역할 🚩 1. Linear Layout ➡ android:orientation="horizontal" ⬇ android:orientation="vertical" 위젯의 크기와 상관없이 한 줄로만 배열됨. overlap X. stacked O. weight : 자식들이 배치될 때 위젯들이 차지하는 영역을 전체 대비 비율 개념으로 지정 🚩 2. Relative Layout 자식들이 상대적 배치 관계에 따라 위치 결정됨 (ex. B toRightOf A, A below C 등등) 배치 기준 정하지 않으면 중첩되어 나타남 위젯 입장에..
1. Fragment는 무엇인가? Activity 내에 생성되는 UI 구성을 여러 개의 모듈 단위로 작성할 수 있도록 해주는 기능 "하위 액티비티" 와 같은 개념 하나의 Fragment를 여러 Activity에서 재사용 가능해서 UI 구성에 소요되는 작업량을 줄일 수 있다. public class FragmentA extends Fragment { public FragmentA() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { return inflater.inflate(R.layout...
1. Activity는 무엇인가? Activity는 UI 구성을 위해 가장 기본이 되는 요소이다. Activity는 화면에 view를 표시하기 위한 tool이다. 앱에서는 최소 하나의 activity(MainActivity)가 있어야 하고 앱이 실행되면서 액티비티가 자동으로 실행되면서 사용자에게 UI가 보인다. 안드로이드 스튜디오에서 새로운 프로젝트를 생성하면 기본적으로 MainActivity.java와 activity_main.xml이 있다. public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSt..
문제 https://www.acmicpc.net/problem/13305 코드 #include #include using namespace std; long long km[100000]; long long pr[100000]; int main(){ cin.tie(0), cout.tie(0); ios_base::sync_with_stdio(0); long long total = 0; int n; cin >> n; for(int i=0; i> km[i]; } for(int i=0; i> pr[i]; } long long pr_now = pr[0]; for (int i=1; i pr[i]){ total += pr_now * km[i-1]; pr_now = pr[i]; } else{ total += pr_now..
문제 https://www.acmicpc.net/problem/11047 코드 #include #include #include using namespace std; vector v; int main(){ cin.tie(0), cout.tie(0); ios_base::sync_with_stdio(0); int n, k, x; int count = 0; cin >> n >> k; for(int i=0; i> x ; v.push_back(x); } sort(v.begin(), v.end(), greater()); for(int i=0; i= 0){ k = k-v[i]; count++; } } cout
문제 https://www.acmicpc.net/problem/11568 코드 #include #include using namespace std; int dp[1001]; int arr[1001]; int main(){ cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int n; cin >> n; for(int i=0; i> arr[i]; dp[i]=1; } //LIS 사용 int result = 1; for(int i=0; i