Gym 100935E Pairs
来源:互联网 发布:淘宝美工大师级 编辑:程序博客网 时间:2024/06/01 07:13
FAQ | About Virtual Judge | Forum | Discuss | Open Source
把所有可能的组合理一下,就会发现组合数中最小的肯定是x1+x2,组合数最大的肯定是x4+x5。所以就可以推出x3.然后就可以一一求解了,类似解方程啊~
#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<cmath>#include<cctype>#include<stdio.h>#define min(a,b)(a<b?a:b)#define max(a,b)(a>b?a:b)#define INF 0x3f3f3f3ftypedef long long ll;using namespace std;int main(){ int T,i,s[11],x[6],ca; ll sum; scanf("%d",&T); for(ca=1;ca<=T;ca++) { sum=0; for(i=1;i<=10;i++) { scanf("%d",&s[i]); sum += s[i]; } sum=sum/4; sort(s+1,s+11); x[3]=sum-s[1]-s[10]; /// s[1]=x1+x2,s[10]=x4+x5; x[1]=s[2]-x[3]; x[2]=s[1]-x[1]; x[5]=s[9]-x[3]; x[4]=s[10]-x[5]; sort(x+1,x+6); printf("Case %d:",ca); for(i=1;i<=5;i++) printf(" %d",x[i]); printf("\n"); } return 0;}
0 0
- Gym 100935E Pairs
- Gym 100935E E. Pairs (模拟)
- Gym-101612E E
- gym 100935E (数学推导 水~)
- Codeforces #81E Pairs
- Woj 1551 - E - Pairs
- CodeForces Gym 100735E
- Codeforces gym 100685 E
- Gym 100712E 贪心
- codeforces [Gym-100814E]
- Codeforces gym 101243 E
- Gym 101161 E
- Gym 101243.E
- Teams Gym-101028E
- Gym 100187E - Two Labyrinths
- Gym 100499E (树DP)
- Gym - 100338E Numbers 贪心
- Gym-100712E-Epic Professor
- 按两次返回键退出程序
- 剑指offer(二十七)之数字在排序数组中出现的次数
- FragmentActivity和Activity的具体区别在哪里
- Unity调用C++的Dll文件,Xcode的.a文件
- 数据库----表设计五大范式所解决的问题
- Gym 100935E Pairs
- TCP和UDP数据包结构
- C++第7次上机实验
- Android开发发布lib到jcenter
- 筋斗云开发技术栈
- Java设计模式之单例设计模式
- 待办
- MySQL学习笔记一
- MySQL入门——创建表的时候给枚举类型的字段赋默认值