传送门

文章目录

  • 题意:
  • 思路:

题意:

思路:

疯狂水文章。
这个很明显是个背包,我们开一个布尔数组,之后枚举每组的个数,让后枚举1−61-61−6,再枚举容量kkk,注意顺序不能错了,让后或一下就好啦。
还可以用bitsetbitsetbitset做,可能是因为bitsetbitsetbitset每次移动的NNN是固定的,而枚举的sumsumsum是根据每次都不一样的,所以bitsetbitsetbitset慢很多。。

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//#pragma GCC optimize(2)
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<cmath>
#include<cctype>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<sstream>
#include<ctime>
#include<cstdlib>
#include<bitset>
#define X first
#define Y second
#define L (u<<1)
#define R (u<<1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].l+tr[u].r>>1)
#define Len(u) (tr[u].r-tr[u].l+1)
#define random(a,b) ((a)+rand()%((b)-(a)+1))
#define db puts("---")
using namespace std;//void rd_cre() { freopen("d://dp//data.txt","w",stdout); srand(time(NULL)); }
//void rd_ac() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//AC.txt","w",stdout); }
//void rd_wa() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//WA.txt","w",stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;const int N=200010,mod=1e9+7,INF=0x3f3f3f3f;
const double eps=1e-6;int a[10];
bool f[N];int main()
{//  ios::sync_with_stdio(false);
//  cin.tie(0);int id=0;while(cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]&&(a[1]+a[2]+a[3]+a[4]+a[5]+a[6])) {printf("Collection #%d:\n",++id);int sum=0; memset(f,false,sizeof(f));for(int i=1;i<=6;i++) sum+=a[i]*i;if(sum%2==1) {puts("Can't be divided.");puts("");continue;}f[0]=1;for(int i=1;i<=6;i++) {for(int j=1;j<=a[i];j++)for(int k=sum;k>=0;k--)f[k+i]|=f[k];}if(f[sum/2]) puts("Can be divided.");else puts("Can't be divided.");puts("");}return 0;
}
/**/
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#pragma GCC optimize(2)
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<cmath>
#include<cctype>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<sstream>
#include<ctime>
#include<cstdlib>
#include<bitset>
#define X first
#define Y second
#define L (u<<1)
#define R (u<<1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].l+tr[u].r>>1)
#define Len(u) (tr[u].r-tr[u].l+1)
#define random(a,b) ((a)+rand()%((b)-(a)+1))
#define db puts("---")
using namespace std;//void rd_cre() { freopen("d://dp//data.txt","w",stdout); srand(time(NULL)); }
//void rd_ac() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//AC.txt","w",stdout); }
//void rd_wa() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//WA.txt","w",stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;const int N=200010,mod=1e9+7,INF=0x3f3f3f3f;
const double eps=1e-6;int a[N];
bitset<N>f;int main()
{//  ios::sync_with_stdio(false);
//  cin.tie(0);int id=0;while(cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]&&(a[1]+a[2]+a[3]+a[4]+a[5]+a[6])) {printf("Collection #%d:\n",++id);int sum=0; f.reset();for(int i=1;i<=6;i++) sum+=a[i]*i;if(sum%2==1) {puts("Can't be divided.");puts("");continue;}f[0]=1;for(int i=1;i<=6;i++) {for(int j=1;j<=a[i];j++)f|=f<<i;}if(f[sum/2]) puts("Can be divided.");else puts("Can't be divided.");puts("");}return 0;
}
/**/

P1537 弹珠 背包可行性dp相关推荐

  1. P7395 弹珠游戏(2021 CoE-I C)

    Description 描述 Alice 对弹珠游戏已经有些厌烦了,她经常在电脑上玩这个游戏.她之所以感到厌烦是因为在这个游戏上她已经是专家级别,她总是能够和电脑打成平手. Alice 创造了一款新的 ...

  2. [Usaco2007 Oct] Super Paintball超级弹珠

    Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 489  Solved: 384 [Submit][Status][Discuss] Descriptio ...

  3. debounceTime 和 throttleTime 的弹珠图

    debounceTime:测试代码 import {concat,debounceTime,filter,interval,mapTo,of,take,throttleTime, } from 'rx ...

  4. 小手工纸盒机器人_亲子手工 | DIY弹珠迷宫小黑手自制玩具系列

    上周用鞋盒做的迷你桌球受到很多男孩子的喜欢 今天小黑手又做了一个瓦楞纸手工 「弹珠迷宫」也是喜欢的爱不释手呢 暑假小黑手系列,希望也能攒出个自己的小游乐场 自己动手做自己的玩具,买玩具的钱可以省了 快 ...

  5. ssr怎么编辑服务器ip_“阴阳师”IP影响力有多大?网易用它做了一款弹珠游戏,TapTap评分高达9.8分...

    文|手游那点事|虹彤.Jimmy "阴阳师"IP衍生的想象空间到底有多大? 在今年的"520发布会"上,网易非常大手笔地公布了<阴阳师>IP的一系列 ...

  6. 13 登陆_《星球大战:弹珠台》中文版即将登陆Switch 12月13日正式发售

    日前,发行商Game Source Entertainment宣布,由Zen Studios开发<星球大战:弹珠台>Switch简/繁体中文版,将在12月13日正式发售. 本作是第一款将于 ...

  7. python 乒乓球_python使用pygame实现笑脸乒乓球弹珠球游戏

    今天我们用python和pygame实现一个乒乓球的小游戏,或者叫弹珠球游戏. 笑脸乒乓球游戏功能介绍 乒乓球游戏功能如下: 乒乓球从屏幕上方落下,用鼠标来移动球拍,使其反弹回去,并获得得分,如果没有 ...

  8. 滚铁环,跳橡皮筋,斗鸡,打弹珠,老鹰捉小鸡…………

    看到这些游戏名称,似曾相识吧,那就让我们来怀念一下怀旧一下,毫无疑问,我小时候经常玩这些游戏,应该很环保很健康很有趣,但如今我都成为孩子他爸了,再看看我的小孩,现在的环境估计很难玩得上这些游戏了,幼儿 ...

  9. linux弹珠游戏实现,弹珠游戏台玩具的详细制作图解

    图片:20180207_171332_3125.jpg 图片:20180207_171332_3127.jpg 图片:20180207_171332_3128.jpg 图片:20180207_1713 ...

最新文章

  1. pandas中DataFrame的ix,loc,iloc索引方式的异同
  2. 20170208--正则表达式
  3. 使用WinSCP在WIndows与树莓派之间传递文件
  4. Draw Call未被批处理?在Unity 5.6中如何查找原因
  5. Unknown: Failed to get convolution algorithm. This is probably because cuDNN
  6. Redis性能问题排查解决手册(值得收藏)
  7. oracle中导入导出数据备份数据库
  8. Greenplum 优化CASE - 对齐JOIN字段类型,使用数组代替字符串,降低字符串处理开销,列存降低扫描开销...
  9. 百度、华为、京东、B站最新面试题汇集,实战篇
  10. origin设置不同区域的颜色_[测试狗]Origin入门教程(二十四):效率翻倍小技巧——修改默认字体...
  11. oracle11g 时间失效,关于oracle11g RAC 的CTSS与ntp时间同步的疑问
  12. VC 获取Windows所有用户的用户名
  13. Exception:A generic error occurred in GDI+
  14. python collections模块_python collections模块
  15. android api解析之TextWatcher(editText输入监控之一)
  16. java宿舍信息管理系统_Java宿舍管理系统
  17. 二维码生成器如何制作圆形二维码
  18. 【linux内核分析与应用-陈莉君】虚拟文件系统的主要数据结构
  19. LT8911EXB:MIPI CSI/DSI转EDP信号转换芯片-润百信科技提供技术批量支持
  20. oracle—高级查询

热门文章

  1. modbus调试工具 linux,linux libmodbus的移植
  2. c#队列取值_C# 队列
  3. 打得了橄榄球大联盟,进得了麻省理工,无论是四肢还是头脑都同样发达,这才叫猛男!...
  4. 身家4400亿美元的他,吃低于3美元的早餐,和2个老婆同居28年!
  5. 这是一份编程宝典,请查收!
  6. tinyid 教程_tinyid
  7. python新手入门总结_初学python的操作难点总结(新手必看篇)
  8. bread是可数还是不可数_雅思官方语法教程之——这个名词到底可不可数?
  9. java set spliterator_Java HashSet spliterator() 方法
  10. 自建比赛服务器,《三国杀》怎么自己创建比赛?自建赛事规则介绍