본문 바로가기

알고리즘

(62)
큰 수 A + B (10757) #include #include using namespace std; int main() { string A, B; cin >> A >> B; int aSize = A.length(); int bSize = B.length(); string Cal = ""; int overnum = 0; while (aSize > 0 || bSize > 0) { int num1= 0; if (aSize > 0) { num1 = A[--aSize] - '0'; } int num2 = 0; if (bSize > 0) { num2 = B[--bSize] - '0'; } int Value = num1 + num2 + overnum; overnum = Value / 10; Value %= 10; char Val = Value +..
부녀회장이 될테야 (2775번) #include using namespace std; int main() { int T, k, n; int count = 0; int sum = 0; int *ptr; cin >> T; while (count > k >> n; ptr = new int[n]; for (int i = 0; i < n; i++) { ptr[i] = i + 1; } if (k == 0) { cout
ACM 호텔 (10250번) #include using namespace std; int main() { int a; int count = 0; int quotient = 0; int remainder = 0; cin >> a; int **ptr; ptr = new int*[a]; for (int i = 0; i > ptr[count][i]; } quotient = ptr[count][2] / ptr[count][0]; remainder = ptr[count][2] % ptr[count][0]; if (remainder == 0) { cout
달팽이는 올라가고 싶다 #include using namespace std; int main() { int A, B, V; cin >> A >> B >> V; if (A >= V) cout
분수 찾기 #include using namespace std; int main() { int n = 0; int SumCount = 0; int x; int numerator = 0; int denominator = 0; cin >> x; while (SumCount < x) { n++; SumCount = n * (n + 1) / 2; } if (n % 2 != 0) { numerator = n - (x - (n * (n - 1) / 2) - 1); denominator = 1 + (x - (n * (n - 1) / 2) - 1); } else { numerator = 1 + (x - (n * (n - 1) / 2) - 1); denominator = n - (x - (n * (n - 1) / 2) - 1); ..
벌집 #include using namespace std; int main() { int room = 1, i = 0; int N; cin >> N; while (1) { room = room + 6 * i; if (N
설탕 배달 #include using namespace std; int main() { int a5, a3; int Num; int i = 0; cin >> Num; a5 = Num / 5; while (1) { if (Num % 5 == 0) { cout
손익분기점 #include using namespace std; int main() { int price[3]; for (int i = 0; i > price[i]; if ((price[2] - price[1])