본문 바로가기

전체 글

[C++] 백준 1924번 : 2007년 https://www.acmicpc.net/problem/1924 #include using namespace std; int main(){ int x,y; int num; cin >> x >> y; switch(x){ case 1: num = 0; break; case 2: num = 31; break; case 3: num = 31+28; break; case 4: num = 31+28+31; break; case 5: num = 31+28+31+30; break; case 6: num = 31+28+31+30+31; break; case 7: num = 31+28+31+30+31+30; break; case 8: num = 31+28+31+30+31+30+31; break; case 9: num =.. 더보기
[C++] 백준 1546번 : 평균 https://www.acmicpc.net/problem/1546 #include using namespace std;int main() { int n;cin >> n;int *score = new int[n];for (int i = 0; i > score[i]; int best;best = score[0];for (int i = 0; i < n - 1; i++){if (best < score[i + 1])best = score[i + 1];} float sum = 0;for (int i = 0; i < n; i++) sum = sum + (float)score[i] / best *100;cout 더보기
[C++] 백준 1476번 : 날짜 계산 https://www.acmicpc.net/problem/1476 #include using namespace std;int main() { int E, S, M;cin >> E >> S >> M;int year = 1;int E_s = 1, S_s = 1, M_s = 1; while (1) {if ((E_s == E) && (S_s == S) && (M_s == M)) break;else year++; E_s++;S_s++;M_s++;if (E_s == 16) E_s = 1;if (S_s == 29) S_s = 1;if (M_s == 20) M_s = 1; }cout 더보기
[C++] 백준 1475번 : 방 번호 https://www.acmicpc.net/problem/1475 #include using namespace std;int main() {int n;cin >> n;int cnt=0;int N_div=1; int m = n;while (1) {if (m / 10 > 0) {cnt++;m = m / 10;N_div = N_div * 10;}elsebreak;} int number[9];for (int i = 0; i < 9; i++) number[i] = 0; for (int i = 0; i 더보기
[C++] 백준 1237번 : 정ㅋ벅ㅋ https://www.acmicpc.net/problem/1237 #include using namespace std;int main(){ cout 더보기
[C++] 백준 1193번 : 분수찾기 https://www.acmicpc.net/problem/1193 #include using namespace std;int main() {int n = 1, num;int a, b;cin >> num; while ((1 + n)*n / 2 < num) { n++; }if (n % 2)//짝수{num = num - n * (n - 1) / 2;a = n - num + 1;b = num;}else {num = num - n * (n - 1) / 2;a = num;b = n - num + 1;}cout 더보기
스레드 블록 아키텍처(Thread Block Architecture) - 그리드 블록 모델 -2 2.3 스레드 블록 생성 가이드라인 -CUDA 프로그래밍에서 1개의 블록은 최대 512개의 스레드를 가질 수 있다. -프로그램을 구현할떄 1개 블록이 가지는 스레드의 개수는 32 또는 64의 배수로 지정하는 것이 좋다.(SM이 32배수 단위로 동작하게 되어 있기 때문에 나머지가 발생하지 않는다. NVIDIA의 사양서는 64배수를 권장한다.) -최대 블록의 크기는 65,535 X 65,535 까지 지정할 수 있으므로 CUDA프로그래밍의 스레드와 블록의 수는 작업을 분할하는 기준으로 많은 수를 지정하는 것이 좋다. 그러면 GPU는 SM단위로 블록을 처리하면서 작업을 진행하게 된다. | GPU의 블록 단위 작업 처리 | CUDA 프로그램의 자동 확장성 위의 그림은 SM이 프로그램을 블록 단위로 병렬처리하는 과.. 더보기
[C++] 백준 10808번 : 알바뱃 개수 https://www.acmicpc.net/problem/10808 #include #include using namespace std; int main() { string S; cin >> S; int alpha[26] = { 0 }; for (int i = 0; i < S.length(); i++) alpha[S[i] - 97]++; for (int i = 0; i < 26; i++) cout 더보기