3등의 성적은 #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { //freopen("input.txt", "rt", stdin); int n, i, j, tmp, cnt=1; int a[101]; scanf("%d", &n); for(i=0; i < n; i++){ scanf("%d", &a[i]); } for(i=0; i < n; i++){ for(j=i+1; j < n; j++){ if(a[i]a[j+1]) { tmp = a[j]; a[j] = a[j+1]; a[j+1] = tmp; } } } for(i=0; i
알고리즘 문제를 풀던중에 "C2H4"문자열을 입력받고 배열에 넣어서 숫자화를 시켜야 하는데 배열을 초기화하는 방법이 헷갈렸다. 문제 소스 #include int main(){ char ch[10]; int res, cnum=1, hnum=1; scanf("%s", &ch); if(ch[1]=='H'){ cnum = 1; pos = 1; } else { for(i=1; ch[i]!='H'; i++){ cnum = cnum*10 + (ch[i]-48); } pos=i; } if(ch[pos+1]=='\0'){ hnum = 1; } else { for(i=pos+1; ch[i]!='\0'; i++){ hnum = hnum*10 + (ch[i]-48); } } res = cnum*12+hnum; printf("..
C2H2 를 입력 char ch[10]; int res; ch 입력, res 출력하고자 하는 경우 scanf() scanf("%s", &ch); C2H2가 입력된다. scanf("%d", &ch); 주소값이 입력된다. 문자열을 그대로 입력받고 싶다면 scanf에 "%s"로 받아야 한다. printf() printf("%d", res); 출력안됨 %d는 문자형만 출력한다. printf("%s", res); 28 정상출력 res가 정수형이기 때문에 정상출력된다. scanf와 printf를 사용할 경우 메인함수 전에 를 include 시켜줘야 한다. 사용예) #include
탄화수소 질량 #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { //freopen("input.txt", "rt", stdin); char ch[10]; int i, a, pos, res, cnum=0, hnum=0; scanf("%s", &ch); if(ch[1]=='H'){ cnum = 1; pos = 1; } else { for(i=1; ch[i]!='H'; i++){ cnum = cnum*10 + (ch[i]-48); } pos=i; } if(ch[pos+1]=='\0'){ hnum = 1; } else { for(i=pos+1;..
3의 개수구하기 #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { //freopen("input.txt", "rt", stdin); int n, cur, k=1, lt=1, rt, res=0; scanf("%d", &n); while(lt!=0){ lt=n/(k*10); rt=n%k; cur=(n/k)%10; if(cur>3) res=res+((lt+1)*k); else if(cur==3) res=res+((lt*k)+(rt+1)); else res=res+(lt*k); k=k*10; } printf("%d\n", res); return..
N!의 표현법 #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { //freopen("input.txt", "rt", stdin); int n, i, j, tmp; scanf("%d", &n); std::vector a(n+1); for(i=2; i
연속부분증가수열 // 내가 짠코드 #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { //freopen("input.txt", "rt", stdin); int n, i, cnt=1, max=-2147000000; scanf("%d", &n); std::vector a(n); for(i=1; i
- Total
- Today
- Yesterday
- 인접행렬
- 재귀함수
- client side rendering
- Stack
- 자료구조
- 이진탐색
- 인접리스트
- stackframe
- BFS
- C
- dfs
- 동적프로그래밍
- 스텍
- 소프트웨어
- 운영체제
- 세마포어
- 입출력장치
- 배열
- javascript
- 구조체
- Java
- 퀵정렬
- 클래스
- C++
- react
- 최단경로
- 병행프로세스
- server side rendering
- 알고리즘
- 교착상태
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |