题目链接:Lead of Wisdom

题意:有n个物品,这些物品有k种类型。每种物品有对应的类型ti,其他值ai,bi,ci,di

你可以选择一些物品,但是这些物品要保证它们任意两者之间类型不能相同,即ti != tj。最后输出最大的DMG

题解:

如果输入的物品总类型数量有ans种,那么肯定是选择ans个物品最后的DMG最大,怎么选ans个物品,就暴力枚举就行

代码:

 1 #include <cstdio>
2 #include <algorithm>
3 #include <iostream>
4 #include <vector>
5 #include <map>
6 #include <queue>
7 #include <set>
8 #include <ctime>
9 #include <cstring>
10 #include <cstdlib>
11 #include <math.h>
12 using namespace std;
13 typedef long long ll;
14 const int maxn=65;
15 const int eps=1e-6;
16 struct Node
17 {
18 ll a, b, c, d;
19 } p;
20 vector<Node> vec[maxn];
21 ll vis[maxn];
22 ll dfs(ll u, ll a, ll b, ll c, ll d, ll now)
23 {
24 if (u == now + 1)
25 {
26 return (100 + a) * (100 + b) * (100 + c) * (100 + d);
27 }
28 ll n = vec[u].size();
29 ll ans = 0;
30 for (ll i = 0; i < n; i++)
31 {
32 p = vec[u][i];
33 ans = max(ans, dfs(u + 1, a + p.a, b + p.b, c + p.c, d + p.d, now));
34 }
35 return ans;
36 }
37 int main()
38 {
39 ios::sync_with_stdio(false);
40 cin.tie(0);
41 int t;
42 ll ans = 1;
43 for (int i = 0; i < 16; i++)
44 ans *= 3;
45 cout << ans << endl;
46 cin >> t;
47 while (t--)
48 {
49 ll n, k, cnt = 0;
50 cin >> n >> k;
51 for (ll i = 1; i <= n; i++)
52 vec[i].clear(), vis[i] = 0;
53 for (ll i = 0; i < n; i++)
54 {
55 ll kind, a, b, c, d;
56 cin >> kind >> a >> b >> c >> d;
57 if (!vis[kind])
58 vis[kind] = ++cnt;
59 vec[vis[kind]].push_back({a, b, c, d});
60 }
61 cout << dfs(1, 0, 0, 0, 0, cnt) << endl;
62 }
63 }

题目链接:The Oculus

题意:

定义一个斐波那契新数列,F[1]=1,F[2]=[2],F[n]=F[n-1]+F[n-2]

一个数x可有斐波那契数列得出,例如 4 = (1*1+2*0+3*1)    5 = (1*0+2*0+3*0+5*1),所以
4=(1,0,1), 5=(0,0,0,1)就是4、5的斐波那契数列

那么题目给你一个数A和数B的斐波那契数列,给你一个大于数C(A*B=C)的斐波那契数列,让你修改一下这个数列中某位的值,使得得到真的C的斐波那契数列。

最后输出你修改的是数列中那位的值

代码:

 1 #include <cstdio>
2 #include <algorithm>
3 #include <iostream>
4 #include <vector>
5 #include <map>
6 #include <queue>
7 #include <set>
8 #include <ctime>
9 #include <cstring>
10 #include <cstdlib>
11 #include <math.h>
12 using namespace std;
13 typedef long long ll;
14 typedef unsigned long long ull;
15 const int maxn=2e6+10;
16 const int eps=1e-6;
17 ull dp[maxn];
18 int main()
19 {
20 ios::sync_with_stdio(false);
21 cin.tie(0);
22 dp[1] = 1ull, dp[2] = 2ull;
23 for (ull i = 3; i <maxn; i++)
24 dp[i] = dp[i - 1] + dp[i - 2];
25 ull t;
26 cin >> t;
27 while (t--)
28 {
29 ull a, b, c, res = 0, ans = 0, cra = 0, x;
30 cin >> a;
31 for (ull i = 1; i <= a; i++)
32 {
33 cin >> x;
34 if (x == 1)
35 res += dp[i];
36 }
37 cin >> b;
38 for (ull i = 1; i <= b; i++)
39 {
40 cin >> x;
41 if (x == 1)
42 ans += dp[i];
43 }
44 cin >> c;
45 for (ull i = 1; i <= c; i++)
46 {
47 cin >> x;
48 if (x == 1)
49 cra += dp[i];
50 }
51 ans *= res;
52 ull j = 1;
53 while (cra != ans-dp[j])
54 j++;
55 cout << j << endl;
56 }
57 }

最新文章

  1. Ported my old SPH solver in Unity
  2. 合唱队形2(洛谷U5874)
  3. 导出excel乱码问题
  4. DCMTK354之VC++ 2008 MFC应用程序配置完整过程
  5. 菜鸟学Linux命令:tail命令 查看日志
  6. 服务器安装MongoDB
  7. [ActionScript] AS3代码实现曝光过度效果
  8. java设计模式类图大全
  9. 文件(夹)比较 Beyond Compare, Diff
  10. datagridview bindingsource刷新数据
  11. 【网络流#6】POJ 3041 Asteroids 二分图最大匹配 - 《挑战程序设计竞赛》例题
  12. JavaScript动态加载资源【js|css】示例代码
  13. Dynamics CRM Plugin DLL恢复工具
  14. Mysql七种 JOIN 连接
  15. Android Studio连接天天模拟器
  16. Spring基于注解和XML混合方式的使用
  17. 实践:C++平台迁移以及如何用C#做C++包装层
  18. 百度api:根据经纬度获取地理位置信息
  19. Apache 流框架 Flink,Spark Streaming,Storm对比分析(二)
  20. 基于HTML5 SVG和CSS3炫酷蹦床式图片切换特效

热门文章

  1. LeetCode542 01矩阵
  2. python常见题型
  3. MySQL常用的一些(就几个)聚合函数
  4. 【Docker】/usr/bin/docker-current: Cannot connect to the Docker daemon at unix
  5. kubernets之configMap和secret
  6. Windows+.Net Framework+svn+IIS在Jenkins上的自动化部署入门
  7. su3和SU01中参数说明
  8. STGAN: A Unified Selective Transfer Network for Arbitrary Image Attribute Editing 阅读笔记和pytorch代码解读
  9. 输入5V,输出5V限流芯片,4A限流,短路保护
  10. 解决Linux下mysql区分大小写的问题