4422

小于等于3 的时候就是1024 4的时候 讨论 5的时候讨论 注意重量为0的情况

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<cmath>
using namespace std;
int a[];
int n;
int main()
{
int i,j,g;
while(scanf("%d",&n)!=EOF)
{
int sum=;
for(i = ; i <= n ; i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
if(n<=)
{
printf("1024\n");
continue;
}
else
{
if(n==)
{
int flag = ;
for(i = ; i <= n ; i++)
{
int s1 = ;
for(j = ; j <= n ; j++)
if(j!=i)
s1+=a[j];
if(s1%==)
{
flag = ;
break;
}
}
int maxz=;
for(i = ; i <= n ; i++)
for(j = ; j <= n ; j++)
{
if(j!=i)
{
if(a[i]+a[j])
{
if((a[i]+a[j])%==)
maxz = ;
else
maxz = max(maxz,(a[i]+a[j])%);
}
}
}
if(flag)
printf("1024\n");
else
printf("%d\n",maxz);
}
else
{
int maxz = ;
for(g = ; g <= n ; g++)
{
for(i = ; i <= n ; i++)
{
if(i==g) continue;
int s1 = ;
for(j = ; j <= n ; j++)
if(j!=i&&j!=g)
s1+=a[j];
if(s1%==)
{
if((sum-s1)&&(sum-s1)%==)
maxz = ;
else
maxz = max(maxz,(sum-s1)%);
}
}
}
printf("%d\n",maxz);
}
}
}
return ;
}

hdu4422The Little Girl who Picks Mushrooms的更多相关文章

  1. ZOJ - 3657-The Little Girl who Picks Mushrooms

    /*ZOJ Problem Set - 3657 The Little Girl who Picks Mushrooms Time Limit: 2 Seconds Memory Limit: 327 ...

  2. HDU 4422 The Little Girl who Picks Mushrooms ( 模拟)

    Problem Description It's yet another festival season in Gensokyo. Little girl Alice planned to pick ...

  3. HDU 4422 The Little Girl who Picks Mushrooms(数学)

    题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=4422 Problem Description It's yet another festival s ...

  4. 状态压缩 UVALive 6068 The Little Girl who Picks Mushrooms (12长春C)

    题目传送门 题意:采蘑菇.现在采了n座山,共5座山,最后要求有三个篮子的蘑菇量是1024的整数倍,丢掉后一直减1024直到不超过1024 分析:n <= 3时直接1024,否则状压枚举哪三个篮子 ...

  5. HDU 4422 The Little Girl who Picks Mushrooms

    题意:一共有5座山,已知小女孩在n座山采了n篮蘑菇,如果n小于5则在其他的山里采了任意重量的蘑菇,给出每篮蘑菇的重量,她回去的时候会遇到仨女巫要她交出三篮蘑菇的重量和恰好为1024的倍数,否则就把她的 ...

  6. HDU 4422 The Little Girl who Picks Mushrooms(简单题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4422 题目大意:小姑娘背着5个包去山上采蘑菇,每座山上只能用一个背包采集.三个小精灵会要她3个背包,其 ...

  7. Random Forest Classification of Mushrooms

    There is a plethora of classification algorithms available to people who have a bit of coding experi ...

  8. Comparing the contribution of NBA draft picks(转)

    When it comes to the NBA draft, experts tend to argue about a number of things: at which position wi ...

  9. hdu 6406 Taotao Picks Apples 线段树 单点更新

    Taotao Picks Apples Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Ot ...

随机推荐

  1. mvc从xheditor编辑器中获取内容时存在潜在危险

    xmfdsh在使用xheditor提交要发布的文章等内容的时候出现了如下的错误: 从客户端(Content="<p style="text-align...")中检 ...

  2. 快速、直接的XSS漏洞检测爬虫 – XSScrapy

    XSScrapy是一个快速.直接的XSS漏洞检测爬虫,你只需要一个URL,它便可以帮助你发现XSS跨站脚本漏洞. XSScrapy的XSS漏洞攻击测试向量将会覆盖 Http头中的Referer字段 U ...

  3. Firefly卡牌手游《暗黑世界V1.5》服务器端源码+GM管理后台源码

    http://www.9miao.com/content-6-304.html Firefly卡牌手游<暗黑世界V1.5>服务器端源码+GM管理后台源码 关于<暗黑世界V1.5> ...

  4. MYSQL注入天书之stacked injection

    第三部分/page-3 Stacked injection Background-8 stacked injection Stacked injections:堆叠注入.从名词的含义就可以看到应该是一 ...

  5. 斌哥的 Docker 进阶指南

    过去的一年中,关于 Docker 的话题从未断过,而如今,从尝试 Docker 到最终决定使用 Docker 的转化率依然在逐步升高,关于 Docker 的讨论更是有增无减.另一方面,大家的注意力也渐 ...

  6. Xcode 创建静态库和动态库

    1.linux中静态库和动态库区别: 库从本质上来说是一种可执行代码的二进制格式,可以被载入内存中执行.库分静态库和动态库两种. 静态库:这类库的名字一般是libxxx.a:利用静态函数库编译成的文件 ...

  7. HDU 5151 Sit sit sit 区间DP + 排列组合

    Sit sit sit 问题描述 在一个XX大学中有NN张椅子排成一排,椅子上都没有人,每张椅子都有颜色,分别为蓝色或者红色. 接下来依次来了NN个学生,标号依次为1,2,3,...,N. 对于每个学 ...

  8. 如何在jmeter中调用自己写的java工具包

    本文介绍在jmeter中调用自己写java工具包,并非直接继承jmeter提供的java sample request接口. 工具/原料 jmeter eclipse 方法/步骤 通常用jmeter做 ...

  9. AC自动机总结

    AC自动机的模板 void buildAC() { while(!q.empty()) q.pop(); q.push(); while(!q.empty()) { int x=q.front();q ...

  10. Spring REST for DELETE Request Method Not Supoorted

    http://stackoverflow.com/questions/22055251/sending-data-with-angularjs-http-delete-request I have a ...