#1929번 소수 구하기 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a,b =0; bool check[1000001] = {false,}; cin >> a >> b; check[1] = {true}; for(int i=2; i=a&&i 🖥️ CS/Baekjoon Algorithms 2020.02.17
#10250번 ACM 호텔 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int testcase = 0; cin >> testcase; for(int i=0; i> h >> w >> c; int ans = 0; if(c%h==0) ans+=h*100+c/h; else if(c%h!=0) ans+=c%h*100+c/h+1; cout 🖥️ CS/Baekjoon Algorithms 2020.02.16
#2869번 달팽이는 올라가고 싶다 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a,b,v = 0; // a=낮에 올라가는 높이, b=밤에 미끄러지는 높이, c=정상까지 높이 int ans = 1; //구하려는 정답 cin >> a >> b >> v; int gap = a-b; ans += (v-a)/gap; if((v-a)%gap!=0) ans++; cout 🖥️ CS/Baekjoon Algorithms 2020.02.16
#1193번 분수찾기 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i = 0; int x = 0; int y = 1; // 분기점 숫자 bool check = true; //true는 홀수, false = 짝수 cin >> i; while(x=i) break; y++; } if(y%2==0) check = false; if(check==true) { cout 🖥️ CS/Baekjoon Algorithms 2020.02.13
#2292번 벌집 (c++) int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int num = 0; // 방의 숫자 int ans = 1; //누적되는 6의 배수 int i = 1; // 거쳐가는 방의 방문 수 cin >> num; while(ans 🖥️ CS/Baekjoon Algorithms 2020.02.12
#2839번 설탕 배달 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int w = 0; int a,b,i=0; cin >> w; while(a>=0) { a=(w/5)-i; if(a 🖥️ CS/Baekjoon Algorithms 2020.02.12
#1712번 손익분기점 (c++) #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a,b,c = 0; // a= 고정 비용 , b = 노트북 한 대 생산가격, c = 노트북 가격 cin >> a >> b >> c; if(b>=c) { cout a >> b >> c; int manu = a+b; if(b>=c) { cout =0) { manu+=(b-c); i++; } cout 🖥️ CS/Baekjoon Algorithms 2020.02.12
#1316번 그룹단어체커 (c++) #include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int test = 0; int ans = 0 ; bool check1 = false; bool check2 = false; cin >> test; for(int i=0; i> s; if(s.size() 🖥️ CS/Baekjoon Algorithms 2020.02.11
#1065번 한수 (c++) #include using namespace std; bool check(int a) { if(((a/100)-(a/10)%10)==((a/10)%10-a%10)) return true; else return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int ans = 0; int get = 0; cin >> get; bool num[1001]; // 0~1000개 for(int i=0; i 🖥️ CS/Baekjoon Algorithms 2020.02.08
#4673번 셀프넘버 (c++) #include using namespace std; int check(int a) { return a+(a/1000)+(a/100)%10+(a/10)%10+a%10; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); bool list[10000]; // 0 ~ 9999 for(int i=0; i 🖥️ CS/Baekjoon Algorithms 2020.02.08