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. nsight 初级使用指南

    1.安装,没有什么特殊设置 2.打开vs,编译生成你需要分析的.exe,在vs上方菜单,有nsight menu, choose Start Graphics Debugging. 3.在弹出对话框中 ...

  2. 获取iframe中的元素

    父窗口中获取iframe中的元素 var ifr = document.getElementById('suggustion').contentWindow.document.body; 在ifram ...

  3. [工作积累] OpenGL ES3.0: glInvalidateFramebuffer

    https://www.khronos.org/opengles/sdk/docs/man3/html/glInvalidateFramebuffer.xhtml 这个在GLES2.0上只有Exten ...

  4. procedure can't return a result set in the given context

    调用存储过程失败!出现如下错误:PROCEDURE ipbx.qu_ery can't return a result set in the given context, ipbx是数据库, qu_e ...

  5. Changing the Overridden Method’s Characteristics

    修改重写方法的特征 在大多数情况下,我们重写(override)一个 virtual 方法是为了改变它的实现.然后,有时我们却想改变该 virtual 方法的其他的特征,这往往会带来一系列问题. 1) ...

  6. 安装Genymotion android模拟器

    Genymotion优点: 速度快性能好,资源占用低,系统要求512MB内存就能运行 支持 OpenGL 3D加速,可以流畅玩大型3D游戏 支持同时启动多个模拟器,可以实现软件或游戏多开 支持多种虚拟 ...

  7. 经典SQL查询语句大全

    一.基础1.说明:创建数据库CREATE DATABASE database-name2.说明:删除数据库drop database dbname3.说明:备份sql server--- 创建 备份数 ...

  8. Gradle Goodness: Skip Building Project Dependencies

    If we use Gradle in a multi-module project we can define project dependencies between modules. Gradl ...

  9. lintcode:数字组合I

    数字组合I 给出一组候选数字(C)和目标数字(T),找到C中所有的组合,使找出的数字和为T.C中的数字可以无限制重复被选取. 例如,给出候选数组[2,3,6,7]和目标数字7,所求的解为: [7], ...

  10. JTAG ARM-OB 被识别为盗版修复的方法

    今天下了一个 Keil 的最新版 V4.70,打开工程,弹出个升级Jlink固件的对话框,也没仔细看,直接点了yes .这下爽了,升级之后弹出个对话框说我的Jlink是盗版的,然后工程自动关闭,很是无 ...