ZOJ 3657 The Little Girl who Picks Mushrooms(2012长春现场赛C题)
来源:互联网 发布:盗扣扣软件 编辑:程序博客网 时间:2024/06/05 04:53
题意:
思路: 把n<4 时,至少有两个可以自己选择采多少。用其中一个,与其他的两个凑成1024的整数倍。给Sunny, Lunar and Star.
用另外的凑成1024,这样就不会给, Marisa了;答案为1024
n=4时。如果用其中的3个可以组成1024 的倍数,给Sunny, Lunar and Star. 则答案为1024
否则: (任取其中的两个的和-1)%1024+1.为答案
n=5时 同理:
#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <iostream>#include <queue>#include <stack>using namespace std;int n,re[19];const int M = 1024;int oor(int i,int j,int k){ return (re[i]+re[j]+re[k])%M==0;}void op4(){ if(oor(1,2,0)||oor(0,1,3)||oor(0,2,3)||oor(1,2,3)) { printf("1024\n");return ; } int ans = 0; for(int i=0;i<4;i++) for(int j=i+1;j<4;j++) { ans = max(ans,(re[i]+re[j]-1)%M+1); } printf("%d\n",ans);}void op5(){ int ans = 0; for(int i=0;i<5;i++) for(int j=i+1;j<5;j++) for(int k=j+1;k<5;k++) if(oor(i,j,k)) { int x,y; for(int l=0;l<5;l++) if(l!=i&&l!=j&&l!=k) x=y,y=l; ans = max(ans,(re[x]+re[y]-1)%M+1); } printf("%d\n",ans);}int main(){ freopen("in.txt","r",stdin); while(~scanf("%d",&n)) { for(int i=0;i<n;i++) scanf("%d",&re[i]); if(n<=3){ printf("1024\n"); continue; } if(n==4) op4(); else op5(); } return 0;}
- ZOJ 3657 The Little Girl who Picks Mushrooms(2012长春现场赛C题)
- zoj The Little Girl who Picks Mushrooms
- HDU 4422 The Little Girl who Picks Mushrooms (2012年长春赛区现场赛C题)
- ZOJ Problem Set - 3657The Little Girl who Picks Mushrooms
- ZOJ 3657 The Little Girl who Picks Mushrooms
- ZOJ 3657 The Little Girl who Picks Mushrooms(12年长春区域赛-C题-枚举)
- The Little Girl who Picks Mushrooms
- HDUOJ4422 The Little Girl who Picks Mushrooms
- The Little Girl who Picks Mushrooms
- zoj3657-The Little Girl who Picks Mushrooms
- The Little Girl who Picks Mushrooms HDU
- The Little Girl who Picks Mushrooms(HDU
- The Little Girl who Picks Mushrooms
- The Little Girl who Picks Mushrooms HDU
- ACM->逻辑判断 ZOJ 3657 The Little Girl who Picks Mushrooms
- ZOJ 3657The Little Girl..2012长春现场赛C题(简单思维+细心)
- hdu 4422 The Little Girl who Picks Mushrooms
- hdu 4422The Little Girl who Picks Mushrooms
- 8086cpu汇编指令总结
- IAR编译“地址无关代码”(PID)选项
- Intel架构程序员手册(翻译-连载)
- 在浏览器中简单输入一个网址,解密其后发生的一切(http请求的详细过程)
- Activity的4中状态及执行顺序
- ZOJ 3657 The Little Girl who Picks Mushrooms(2012长春现场赛C题)
- Sencha touch chart的应用与学习
- Visual 2012 C++ 创建和静态调用dll
- linux下解压命令大全
- Factory 模式
- VB与Java颜色值的转换
- BroadcastReceiver概述
- 恢复实验室wordpress博客系统的详细总结
- 不错的购书网站Chinapub