Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- CustomScrollView
- 테스트
- livedata
- data
- tabbar
- 앱바
- intent
- Flutter
- 앱
- ScrollView
- android
- Kotlin
- Navigation
- appbar
- viewmodel
- textview
- 안드로이드
- Dialog
- DART
- textfield
- Coroutines
- drift
- binding
- scroll
- activity
- LifeCycle
- 계측
- Button
- Compose
- TEST
Archives
- Today
- Total
Study Record
[프로그래머스] Level1 - 음양 더하기 / 내적 본문
728x90
음양 더하기
#include <string>
#include <vector>
using namespace std;
int solution(vector<int> absolutes, vector<bool> signs) {
int answer = 0;
for(int i=0; i<absolutes.size(); i++){
if(signs[i]) answer += absolutes[i];
else answer -= absolutes[i];
}
return answer;
}
내적
#include <string>
#include <vector>
using namespace std;
int solution(vector<int> a, vector<int> b) {
int answer = 0;
for(int i=0; i<a.size(); i++){
answer += a[i] * b[i];
}
return answer;
}
728x90
'알고리즘' 카테고리의 다른 글
[프로그래머스] Level2 - 프린터 <Queue> (0) | 2021.12.04 |
---|---|
[프로그래머스] Level2 - 기능개발 (0) | 2021.12.03 |
[프로그래머스] Level1 - 없는 숫자 더하기 (0) | 2021.12.02 |
[프로그래머스] Level2 - 카카오프렌즈 컬러링북 (0) | 2021.12.02 |
[프로그래머스] Level1 - 크레인 인형뽑기 게임 <스택> (0) | 2021.12.02 |