출처 : https://www.hackerrank.com/challenges/non-divisible-subset/problem #include using namespace std; vector split_string(string);int check[100]; int nonDivisibleSubset(int k, vector S) {int ans = 0; memset(check, 0, sizeof(check));for (int i = 0; i < S.size(); i++) {S[i] %= k; check[S[i]]++;}int tmp = k / 2; int i = tmp; int j = tmp + 1;if (check[0]) ans++;if (!(k % 2)) {if (check[tmp]) ans++;i..
출처 : https://www.hackerrank.com/challenges/magic-square-forming/problem #include using namespace std; int MS[8][3][3] = {{ 2,9,4,7,5,3,6,1,8 },{ 4,3,8,9,5,1,2,7,6 },{ 4,9,2,3,5,7,8,1,6 },{ 8,3,4,1,5,9,6,7,2 },{ 8,1,6,3,5,7,4,9,2 },{ 2,7,6,9,5,1,4,3,8 },{ 6,1,8,7,5,3,2,9,4 },{ 6,7,2,1,5,9,8,3,4 }}; int formingMagicSquare(vector s) {int ans = 9999, cnt=0;for (int m = 0; m < 8; m++) {cnt = 0;for (i..
출처 : https://www.hackerrank.com/challenges/extra-long-factorials/problem #include using namespace std; void extraLongFactorials(int n) { vector v; v.push_back(1); for (int i = 2; i n; cin.ignore(numeric_limits::max(), '\n'); extraLongFactorials(n); return 0;}
출처 : https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem #include using namespace std; vector split_string(string); vector climbingLeaderboard(vector scores, vector alice) { int s_size = scores.size(); int a_size = alice.size(); vector ans(a_size), tmp(s_size); int n = 1; tmp[0] = n; for (int i = 1; i < s_size; i++) { if (scores[i] == scores[i - 1]) tmp[i] = n; else tmp[i] = +..
출처 : https://www.hackerrank.com/challenges/time-conversion/problem #include using namespace std; string timeConversion(string s) { if(s.substr(8,2)=="PM") { string ss = s.substr(0,2); int tmp = atoi(ss.c_str()); if(tmp==12) tmp=0; s.replace(0,2,to_string(tmp+12)); s.erase(8,2); } else { if(s.substr(0,2)=="12") s.replace(0,2,"00"); s.erase(8,2); } return s;} int main(){ ofstream fout(getenv("OUTP..
출처 : https://www.hackerrank.com/challenges/birthday-cake-candles/problem #include using namespace std; vector split_string(string); int birthdayCakeCandles(vector ar) { int ans=1; sort(ar.begin(),ar.end()); int tmp = ar[ar.size()-1]; if(ar.size()>2) { for(int i=ar.size()-2;i>=0;i--) { if(tmp==ar[i]) ans++; else break; } } else if(ar.size()==2) { if(tmp==ar[0]) ans++; } return ans;} int main(){ o..
출처 : https://www.hackerrank.com/challenges/diagonal-difference/problem #include using namespace std; int diagonalDifference(vector arr) { int ans1=0; int ans2=0; int s = arr.size(); for(int i=0,j=0; i>=0 && i> n; cin.ignore(numeric_limits::max(), '\n'); vector arr(n); for (int i = 0; i > arr[i][j]; } cin.ignore(numeric_limits::max(..
- Total
- Today
- Yesterday
- 17779
- 17837
- 시간 복잡도
- DP
- 팁
- 17142
- 트렌드
- hackerrank
- 역량 테스트
- 입출력
- 연구소 3
- 2018 카카오 블라인드 채용
- boj
- 미세먼지 안녕!
- STL
- 2018 KAKAO BLIND RECRUITMENT
- string
- SW Expert Academy
- 삼성
- DFS
- scanf
- 17143
- 백준
- 17144
- SWEA
- 게리맨더링 2
- 새로운 게임 2
- 17140
- 알고리즘
- 이차원 배열과 연산
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |