알고리즘 풀면서 시간초과에 대해 많이 고려해봤을 것이다.값들이 약 10만 이상이 되면 시간을 많이 고려해야한다.이때 cin과 scanf 즉, 입출력에서도 시간차이가 난다.편리함 때문에 cin, cout을 많이 썼지만 이는 느리다. 사진 출처 : https://algospot.com/forum/read/2496/ 코드에 ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 위와 같이 쓰면 속도가 향상 되지만 추천하지 않는다. 즉, 알고리즘 문제를 풀때는 C 표준입출력 함수들을 사용하는 것이 좋다. 작성자 : 히더
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14jJh6ACYCFAYD #include #include #include #include using namespace std; int N,result;char arr[10][4] = { "ZRO","ONE","TWO","THR","FOR","FIV","SIX","SVN","EGT","NIN" };int cnt[10]; int main(){int T; int t = 1; string tt;cin >> T;while (T--){cin >> tt; cin >> N;for (int i = 0; i > tmp..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14hwZqABsCFAYD #include #include #include using namespace std; int N,result;int arr[100][100]; int main(){int T; int t=1;T = 10;while (T--){cin >> N; result = 0;for (int i = 0; i > arr[i][j]; for (int j = 0; j < N; j++){for (int i = 0; i < N; i++){if (arr[i][j] == 2) ..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14geLqABQCFAYD #include #include #include using namespace std; int N,result;int a[100], b[100]; void dfs(int now){if (a[now] == 99 || b[now] == 99) { result = 1; return; }else{if(a[now]!=-1)dfs(a[now]);if (b[now] != -1)dfs(b[now]);}} int main(){int T; int t;T = 10;while (T--){cin >> t >> N; result = 0; fill(a..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14eWb6AAkCFAYD #include #include #include using namespace std; int N,result;int check[4]; int main(){int T; int t=1;T = 10;while (T--){cin >> N; result = 1;fill(check, check + 4, 0);for (int i = 0; i > c;if (c == '(') check[0] += 1;else if (c == ')') check[0] -= 1;else if (c == '[') che..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14dUIaAAUCFAYD& #include #include #include using namespace std; int a, b; int cal(int now){if (now == 1)return a;return (a * cal(now - 1));} int main(){int T; int t;T = 10;while (T--){cin >> t;cin >> a >> b; cout
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14Rq5aABUCFAYi #include #include #include using namespace std; int result, N;char arr[100][100]; void cal(int i, int sj, int ej, int l){int zz = 1; int ll = l;if (arr[i][sj] == arr[i][ej]){while (1){if (arr[i][sj + zz] != arr[i][ej - zz]) break; if (ll < 4){result = max(result,l); break;}ll -= 2; zz++;}}int z..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14QpAaAAwCFAYi #include #include #include using namespace std; int result, N;char arr[8][8]; int main(){int T; int t=1;T = 10;while (T--){cin >> N; result = 0;for (int i = 0; i > arr[i][j];}} for (int i = 0; i < 8; i++){for (int j = 0; j < 8; j++){if (i == 1 && j == ..
출처 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14P0c6AAUCFAYi #include #include #include #include using namespace std; int result;string a, b; int main(){int T; int t;T = 10;while (T--){cin >> t; result = 0;cin >> b >> a;for (int i = 0; i < a.length()-(b.length()-1); i++){if (a.at(i) == b.at(0)){int nexta = i + 1; int nextb = 1;for (int k = 1; k < b.lengt..
- Total
- Today
- Yesterday
- DP
- 17140
- 17837
- 연구소 3
- 2018 KAKAO BLIND RECRUITMENT
- 17143
- 백준
- 삼성
- 팁
- boj
- 17142
- string
- 이차원 배열과 연산
- 알고리즘
- 시간 복잡도
- 게리맨더링 2
- 2018 카카오 블라인드 채용
- 입출력
- 미세먼지 안녕!
- scanf
- 역량 테스트
- 트렌드
- 새로운 게임 2
- SWEA
- 17779
- SW Expert Academy
- DFS
- 17144
- STL
- hackerrank
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |