886A. ACM ICPC#均值分配问题(暴力)
题目出处:http://codeforces.com/problemset/problem/886/A
题目大意:已知六个人得分,问是否能分成两个三人队使得每个队伍得分加和相等
#include<stdio.h>
//从六个数中选出三个不重复的数字加和,如果这个和正好为总数的一半即可
int main()
{
int a[];
int i,j,k,sum=,s;
for(i=;i<;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
for(i=;i<;i++)
for(j=i+;j<;j++)
for(k=j+;k<;k++)
{
s=a[i]+a[j]+a[k];
if(s==sum-s)
{
printf("yes\n");
return ;
}
}
printf("no\n");
return ; }
数据较小,对6人加和,然后枚举任意三人情况,如果是总和一半即可
886A. ACM ICPC#均值分配问题(暴力)的更多相关文章
- Codeforces Round #445 A. ACM ICPC【暴力】
A. ACM ICPC time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- Codeforces 890A - ACM ICPC 暴力
A. ACM ICPCtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputst ...
- ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 D. Delay Time
Problem D. Delay Time Input file: standard input Output file: standard output Time limit: 1 second M ...
- HDU 5875 Function 【倍增】 (2016 ACM/ICPC Asia Regional Dalian Online)
Function Time Limit: 7000/3500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total ...
- 训练报告 (2014-2015) 2014, Samara SAU ACM ICPC Quarterfinal Qualification Contest
Solved A Gym 100488A Yet Another Goat in the Garden B Gym 100488B Impossible to Guess Solved C Gym ...
- ACM ICPC Kharagpur Regional 2017
ACM ICPC Kharagpur Regional 2017 A - Science Fair 题目描述:给定一个有\(n\)个点,\(m\)条无向边的图,其中某两个点记为\(S, T\),另外标 ...
- 2017 ACM ICPC Asia Regional - Daejeon
2017 ACM ICPC Asia Regional - Daejeon Problem A Broadcast Stations 题目描述:给出一棵树,每一个点有一个辐射距离\(p_i\)(待确定 ...
- 2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest
2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest A - Arranging Wine 题目描述:有\(R\)个红箱和\(W\)个白箱,将这 ...
- 2017 ACM/ICPC Asia Regional Qingdao Online
Apple Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submi ...
随机推荐
- UVA - 12113 Overlapping Squares(重叠的正方形)
题意:给定一个4*4的棋盘和棋盘上所呈现出来的纸张边缘,问用不超过6张2*2的纸能否摆出指定的形状. 分析:2*2的纸在4*4的棋盘上总共有9种放置位置,枚举所有的放置位置即可.枚举情况总共种. #p ...
- POJ 1944:Fiber Communications
Fiber Communications Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4236 Accepted: 1 ...
- JS ~ Promise.reject()
概述: Promise.reject(reason)方法返回一个带有拒绝原因reason参数的Promise对象. 语法 Promise.reject(reason); reason : 表示Pro ...
- yarn storm spark
单机zookeeper http://coolxing.iteye.com/blog/1871009 storm http://os.51cto.com/art/201309/411003_2.htm ...
- Pycharm2020最新激活码|永久激活(附最新激活码和插件)
最近很多人的Pycharm激活时间又过期了,后台很多人索要激活码,我就再把激活的方法汇和工具再梳理一次给大家. 最主要有两种激活方式(两种方式需要的激活码不同): 一.激活码激活: 一般一年多需要激活 ...
- swift中block的使用
在OC中习惯用block来传值,而swift中,block被重新定义了一下,叫闭包: 使用的技巧:谁定义谁传值: 案例使用A.B控制器: 1~4步在B中执行,最后在A中执行: - B控制器: 1- ...
- 关于torch.nn.Conv2d的笔记
先看一下CLASS有哪些参数: torch.nn.Conv2d( in_channels, out_channels, kernel_size, stride=1, padding=0, dilati ...
- E - Third-Party Software - 2 Gym - 102215E (贪心)
Pavel is developing another game. To do that, he again needs functions available in a third-party li ...
- UNION和UNION ALL的作用和语法
主要就是两句话区别: union是联合的意思,就是合并两个或多个select语句的结果集,并消除重复行: union all 当然也是联合的意思,也是合并两个或多个select语句的结果集,但是保留重 ...
- JDK安装 - Linux环境
JDK安装 - Linux环境 1. 下载 :https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-21331 ...