백준/실버 (285) 썸네일형 리스트형 [백준 6591번] 어항 쇼다운 (C++) 문제링크 : https://www.acmicpc.net/problem/6591 6591번: 이항 쇼다운 각 테스트 케이스에 대해서, 정답을 출력한다. 항상 정답이 231보다 작은 경우만 입력으로 주어진다. www.acmicpc.net #include using namespace std; #define ll long long int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int N, K; while(1) { cin >> N >> K; if(N==0 && K==0) break; ll result = 1; int num = min(K, N-K); //K!, (N-K)! for(int i=1; i [백준 14235번] 크리스마스 선물 (C++) 문제링크 : https://www.acmicpc.net/problem/14235 14235번: 크리스마스 선물 크리스마스에는 산타가 착한 아이들에게 선물을 나눠준다. 올해도 산타는 선물을 나눠주기 위해 많은 노력을 하고 있는데, 전세계를 돌아댕기며 착한 아이들에게 선물을 나눠줄 것이다. 하지만 www.acmicpc.net #include using namespace std; #define ll long long int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int N, A, present; priority_queuepq; cin >> N; while(N--) { cin >> A; if(A==0) { if(pq.empty()) { cout [백준 9324번] 진짜 메시지 (C++) 문제링크 : https://www.acmicpc.net/problem/9324 9324번: 진짜 메시지 스파이들은 사령부와 통신하기 위해서 SMTP(비밀 메시지 전송 프로토콜)를 사용해 비밀 회선으로 전자 메시지를 보낸다. 메시지가 적들에 의해 조작되어 보내진 것이 아닌 진짜 메시지라는 것 www.acmicpc.net #include using namespace std; #define ll long long int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int check[26]; int T; cin >> T; while(T--) { memset(check, 0, sizeof(check)); string result=""; string M;.. [백준 14731번] 謎紛芥索紀 (Large) (C++) 문제링크 : https://www.acmicpc.net/problem/14731 14731번: 謎紛芥索紀 (Large) 성민이는 이번 학기에 미적분학 과목을 수강하고 있다. 다항함수의 미분 단원 과제를 하던 도중 미분을 하기가 귀찮아진 성민이는 미분하려는 함수 f(x)가 주어지면, 미분 된 함수 f’(x)를 자동 www.acmicpc.net #include using namespace std; #define ll long long #define MOD 1000000007 ll cal(ll a) { if(a==0) return 1; ll half = cal(a/2); //반으로 나눠주기 if(a%2==1) return (half * half * 2) % MOD; return (half * half) % M.. [백준 1740번] 거듭제곱 (C++) #include using namespace std; #define ll long long int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; queue q; while(N) { q.push(N%2); //이진수 저장 N/=2; } ll result = 0; ll multiply = 1; while(!q.empty()) { result += q.front() * multiply; multiply *= 3; //3진수 만들기 q.pop(); } cout 2**0 + 2**2 3진수 : 1 0 1 -> 3**0 + 3**2 [백준 11123번] 양 한마리... 양 두마리... (C++) 문제링크 : https://www.acmicpc.net/problem/11123 11123번: 양 한마리... 양 두마리... 얼마전에 나는 불면증에 시달렸지... 천장이 뚫어져라 뜬 눈으로 밤을 지새우곤 했었지. 그러던 어느 날 내 친구 광민이에게 나의 불면증에 대해 말했더니 이렇게 말하더군. "양이라도 세봐!" www.acmicpc.net #include using namespace std; queueq; bool check[101][101]; char c[101][101]; int H, W; int dx[] = { -1,1,0,0 }; int dy[] = { 0,0,-1,1 }; void bfs(int x, int y) { check[x][y] = 1; //양이므로 방문 처리 q.push({ x,y.. [백준 3273번] 두 수의 합 문제의 합 : https://www.acmicpc.net/problem/3273 3273번: 두 수의 합 n개의 서로 다른 양의 정수 a1, a2, ..., an으로 이루어진 수열이 있다. ai의 값은 1보다 크거나 같고, 1000000보다 작거나 같은 자연수이다. 자연수 x가 주어졌을 때, ai + aj = x (1 ≤ i > n; for(int i=0; i> num; arr.push_back(num); } cin >> x; sort(arr.begin(), arr.end()); int l=.. [백준 11332번] 시간초과 (C++) 문제링크 : https://www.acmicpc.net/problem/11332 11332번: 시간초과 각 테스트 케이스들에 대하여 시간 초과가 나면 "TLE!", 시간 초과가 나지 않으면 "May Pass." 를 출력한다. www.acmicpc.net #include using namespace std; #define LL long long #define MAX 100000000 int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int C; LL N, T, L; string S; cin >> C; while(C--) { cin >> S >> N >> T >> L; if(S == "O(N)") { if(N*T 이전 1 ··· 28 29 30 31 32 33 34 ··· 36 다음