有两个序列A和B,A=(a1,a2,...,ak),B=(b1,b2,...,bk),A和B都按升序排列.对于1<=i,j<=k,求k个最小的(ai+bj).要求算法尽量高效. int *min_k(int *A, int *B, int len1, int len2, int k) { if (A == NULL || B == NULL || k <= 0) return NULL; int i, j; int *tmp = new int[k]; i = len1; j = len…
Harry Potter and J.K.Rowling http://acm.hdu.edu.cn/showproblem.php?pid=3982 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1094 Accepted Submission(s): 357 Problem Description In July 31st,…
#include <stdio.h> int main() { int i,j,k; printf("\n"); for(i=1;i<5;i++){ for(j=1;j<5;j++){ for (k=1;k<5;k++){ if (i!=k&&i!=j&&j!=k) printf("%d,%d,%d\n",i,j,k); } } } }…
poj2114 Boatherds Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 1195 Accepted: 387 Description Boatherds Inc. is a sailing company operating in the country of Trabantustan and offering boat trips on Trabantian rivers. All the rivers…
A B C #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #define TS printf("!!!\n") #define pb push_back #define inf 1e9 //std::ios::sync_with_stdio(false); using namespace std; //priority_queue<int,…