摘要:
题意:给n个积木,搭成两个高度相同的塔,问最高高度 正解是dp 答案在dp[n][0] 代码 cpp include using namespace std; int f[2][1000050],n,a[51],ans; int main(){ memset(f, 0x3f,sizeof(f)); 阅读全文
摘要:
题意 dfs骗了30分,一开始想的距离正解差一点啊,贪心加dp就可以过的水题,真正太蒻了 解析 代码 cpp include using namespace std; struct node{ int x; int y; }a[210]; int m,n,k; int f[210][210]; bo 阅读全文
摘要:
一道有趣的题目,首先想到合并果子,然而发现会超时,我们可以发现首先拿出来的切掉后比后拿出来切掉后还是还长,即满足单调递增,故建立三个队列即可。 代码 cpp include define p u/v using namespace std; long long n,m,len,t,a,u,v; co 阅读全文
摘要:
一道sb题目,注意范围,可打表解决,打出杨辉三角,在用前缀和求解即可 代码(一维前缀和) cpp include using namespace std; int n,m,t,k,ans,a[2010][2010],b[2010][2010]; int main(){ scanf("%d %d",& 阅读全文