Algorithm (2139) 썸네일형 리스트형 C++(씨쁠쁠)(cplusplus) - 백준(baekjoon)(BaekJoon)코딩 15552번 : 빠른 A+B 답 ios::sync_with_stdio(false) cin.tie(NULL) 이 두개를 이용해 입 출력 시간을 단축하는 문제입니다. 이 설명은 제 블로그에 cin,cout 시간초과 해결법을 보시면 됩니다. 1234567891011121314#include using namespace std;int main() { cin.tie(NULL); //cin 과 cout을 untie ios::sync_with_stdio(false); //동기화 되어 있는 과 사이의 동기화를 끊어줌으로써 버퍼만 사용 int T; int a, b; cin >> T; while (T--) { cin >> a >> b; cout (C++) - 백준(BOJ) 1010번 : 다리놓기 https://www.acmicpc.net/problem/1010 1010번: 다리 놓기 입력의 첫 줄에는 테스트 케이스의 개수 T가 주어진다. 그 다음 줄부터 각각의 테스트케이스에 대해 강의 서쪽과 동쪽에 있는 사이트의 개수 정수 N, M (0 < N ≤ M < 30)이 주어진다. www.acmicpc.net 조합 문제였습니다. 풀이방법 겹치지 않게 다리를 놓는 방법은 순서에 상관없이 뽑는 조합의 방식과 유사합니다. m개 중 n개를 뽑는 경우의 수를 출력하면 됩니다. Code #include using namespace std; int t; int comb[31][31]; int dfs(int n, int k){ if(n == k || k == 0) return 1; int &ret = comb[n][.. C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 10984번:내 학점을 구해줘 답 학점평균은 어떻게 구할까요??:학점 X 성적 / 학점총합123456789101112131415161718192021222324252627282930#include using namespace std; int main() { int t; //학기 수 int n; //과목 수 double c; //학점 double g; //성적 double ans1; //학점 총점 double ans2; //학점 평균 cin >> t; for (int i = 0; i > n; for (int i = 1; i > c >> g; ans1 += c; ans2 += g * c; } cout C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 1003번 : 피보나치 함수 결국 또 다른 피보나치를 구현하는 문제였습니다. 1.Pair 함수로 배열의 first는 0호출 개수 second는 1호출 개수입니다.123456789101112131415161718192021222324#include #define ll long long using namespace std; pair F[41]; int main() { int T; //테스트 케이스 ll c; // 순서 F[0].first = 1; F[1].second = 1; for (ll i = 2; i > T; for (int i = 1; i > c; cout (C++) - 백준(BOJ) 9946번 : 단어 퍼즐 답 Strcmp(const *char,const *char): 두 문자열이 같은지 다른지를 비교해주는 함수입니다. 1.헤더는 나 이 필요합니다.2.문자열이 같다면 0을 반환하고 다르다면 -1 또는 1을 반환해줍니다. #include #include #include using namespace std; int main() { int as, bs; int i = 1; while (1) { char a[1001], b[1001]; cin >> a >> b; if (!strcmp(a, "END") && !strcmp(b, "END")) { break; } as = strlen(a); bs = strlen(b); if (as != bs) cout C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 11899번:괄호 끼워넣기 답 123456789101112131415161718192021222324252627282930313233#include #include #include using namespace std;stack s;int ans;int main() { string k; cin >> k; for (int i = 0; i (C++) - 백준(BOJ) 2721번 : 삼각수의 합 삼각수는 n이 300까지이므로 T(301)까지 필요합니다. //W(n) = Sum[K=1..n; K*T(k+1)] #include using namespace std; int w[302], t[302],a[302]; int n, h; int main() { for (int i = 1; i > n; cout (C++) - 백준(BOJ) 3035 : 스캐너 답 #include #include #include using namespace std; char scanner[251][251]; int main() { int r, c, zr, zc; cin >> r >> c >> zr >> zc; for (int i = 1; i scanner[i][j]; for (int i = 1; i 이전 1 ··· 213 214 215 216 217 218 219 ··· 268 다음