摘要:
比赛链接 C题 一个二维背包问题 //二维背包 #include <bits/stdc++.h> using namespace std; const int MAXN = 1010; int t[MAXN], a[MAXN], w[MAXN]; int dp[MAXN][MAXN]; int ma 阅读全文
摘要:
A题 #include <bits/stdc++.h> using namespace std; int main () { int t; cin >> t; while(t--) { int n, x; cin >> n >> x; int ans = 0; for(int i = 0; i < 阅读全文
摘要:
A题 思路:取出最小值,所有数加到最小值的最大倍数使得不超过k 记录次数即可 #include <bits/stdc++.h> using namespace std; int main () { int T; cin >> T; while(T--) { int n, k; cin >> n >> 阅读全文
摘要:
对二叉树进行中序遍历,用maxCount记录最大值。如果存在count==maxCount,压进vector之中。如果count更大,更新vector。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * 阅读全文