본문 바로가기

PKU 3132. Sum of Different Primes 서로 다른 두 소수의 합 Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2398 Accepted: 1474 설명 어떤 양정수는 한 가지 이상의 서로 다른 소수들의 합으로 나타낼 수 있습니다. 주어진 두 개의 양정수 n 과 k 를 놓고 볼 때, 당신은 n 이라는 양정수를 k 개의 서로 다른 소수들의 합으로 나타내는 방법을 찾아내야 합니다. 다음에 나오는 예시를 보면 확실하겠지만, 같은 소수 집합으로 합의 순서만 바꾸는 것은 같은 방법을 썼다고 간주합니다. 예를 들어 8 은 3 + 5 와 5 + 3 으로 표현 될 수 있지만 이 두 방법은 구별할 수 없기 때문에 하나의 방법입니다. 만약 n 과 k 가 각각 24 와 3 이라면 답은 2가 되는데 그 이유.. 더보기
PKU 3132. Sum of Different Primes Sum of Different Primes Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2398 Accepted: 1474 Description A positive integer may be expressed as a sum of different prime numbers (primes), in one way or another. Given two positive integers n and k, you should count the number of ways to express n as a sum of k different primes. Here, two ways are considered to be the same if they sum up .. 더보기
PKU 2291. Rotten Ropes. [판정:AC] 이것은 마치 2차방정식의 극한값(최대값)을 찾는 문제와 같구려 ㄲㄲ 처음에 정렬함수 만들기가 귀찮아서 라이브러리함수 갖다 쓰려고 잔머리 굴렸다가 wa ㅋㅋㅋㅋ // PKU 2291. Rotten Ropes #include using namespace std; void bbsort( int *ary, int length ) { int i, j; for( i = 0; i = i; j-- ) { if( ary[j] > ary[j+1] ) { swap( ary[j], ary[j+1] ); } } } } int main() { int t; int n; int w[1000]; int i; int max; scanf( "%d", &t ); w.. 더보기