Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 레드아보
- 1174
- BOJ
- 최소 #공배수 #최대 #공약수 #유클리드 #호제법 #lcm #gcd #c++ #boj #3343 #백준 #장미
- C++
- 호반우 상인
- c++ #입출력 #속도 #ios #sync_with_stdio #cin #cout #tie
- 3343
- 3D #Reconstruction #computer #vision #volume #metric #tsdf #kinect #fusion
- 16202
- 백준
- graph #최단경로
- 22869
- 진법변환 #2to10 #10to2 #이진법 #십진법 #변환 #bitset #c++
- 사이클 없는 그래프
- c++ #boj #
- graph
- 줄어드는수
- LIS #가장긴증가하는부분수열 #
- boj #백준
- 이분탐색 #dp #11053
- hcpc
- N번째큰수
- backtracking #codetree #디버깅 #삼성코테
- 투포인터 #백준 #boj #20922 #22862
- 30870
- 20117
- 백준 #다익스트라 #dijkstra #9370 #c++
- 코딩
- 쌤쌤쌤
Archives
- Today
- Total
hyunjin
[C++][기초 - 종합]1080~1092 본문
728x90
[1080] 입력한 수보다 누적 합이 같거나 커졌을 때, 마지막으로 더한 정수 출력
#include <bits/stdc++.h>
using namespace std;
int main(){
int cut,n=0,sum=0;
cin >>cut;
while(sum<cut){
sum += (++n);
}
cout<<n;
return 0;
}
n++으로 하면 X
[1082]16진수 구구단
#include <bits/stdc++.h>
using namespace std;
int main(){
int n=0;
scanf("%X",&n);
for(int i = 0x1 ; i <=0xF;i++){
printf("%X*%X=%X\n",n,i,i*n);
}
return 0;
}
[1085]
#include <bits/stdc++.h>
using namespace std;
int main(){
float h,b,c,s;
cin >>h>>b>>c>>s;
printf("%.1f MB", ((h*b*c*s)/(8*1024*1024 ) ) );
return 0;
}
- 출력할때 계산되는 식이면 () 괄호로 꼭 묶어주기. 왜인지는 모르겠지만 묶지 않으면 이상한 수가 출력된다.
- 드디어 앞에서 쓴 것 활용. 소숫점 2번째 자리에서 반올림해 첫 번째 자리까지 출력
=> .1f
- 데이터 단위
8 bit = 1 byte
1024 byte = 1KB
1024 KB = 1 MB
1024 MB = 1GB
1024 GB = 1TB
[1087] 1080과 유사
#include <bits/stdc++.h>
using namespace std;
int main(){
int limit,sum=0,n=0;
cin>> limit;
while(sum< limit){
sum+= ++n;
}
cout<< sum;
return 0;
}
[1092]
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,day=1;
cin>> a>>b>>c;
while( (day %a !=0) || (day %b!=0) || (day % c!=0) )
day++;
cout<< day;
return 0;
}
비트 연산자 활용
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,day=1;
cin>> a>>b>>c;
while( (day %a ) | (day %b) | (day % c) )
day++;
cout<< day;
return 0;
}
728x90
'알고리즘 연습 > 코드업' 카테고리의 다른 글
[C++][기초-배열]1093~1099 , vector,stack,2차원 vector 초기화 (0) | 2020.09.04 |
---|---|
[C++][반복실행구조]1071, goto (0) | 2020.09.04 |
[C++][조건/선택 실행 구조]1068 (0) | 2020.09.04 |
[C++][삼항연산자]1064 (0) | 2020.09.04 |
[C++][비트 단위 논리 연산] 1059~ 보수 , ~, & ,| ,^, << ,>> (0) | 2020.09.04 |