CF#248DIV2:A. Kitahara Haruki's Gift_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 12:03:56
原创
1285人浏览过

kitahara haruki has bought n apples for touma kazusa and ogiso setsuna. now he wants to divide all the apples between the friends.

Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equal to the total weight of the apples given to Ogiso Setsuna.

But unfortunately Kitahara Haruki doesn't have a knife right now, so he cannot split any apple into some parts. Please, tell him: is it possible to divide all the apples in a fair way between his friends?

Input

The first line contains an integer n (1?≤?n?≤?100) ? the number of apples. The second line contains n integers w1,?w2,?...,?wn (wi?=?100or wi?=?200), where wi is the weight of the i-th apple.

Output

In a single line print "YES" (without the quotes) if it is possible to divide all the apples between his friends. Otherwise print "NO" (without the quotes).

立即学习前端免费学习笔记(深入)”;

Sample test(s)

input

3100 200 100
登录后复制

output

YES
登录后复制

input

4100 100 100 200
登录后复制

output

NO
登录后复制

Note

In the first test sample Kitahara Haruki can give the first and the last apple to Ogiso Setsuna and the middle apple to Touma Kazusa.

jQuery瀑布流插件Grid-A-Licious
jQuery瀑布流插件Grid-A-Licious

jQuery瀑布流插件Grid-A-Licious是一款简单易用的jQuery插件,可用于创建响应式瀑布流布局,针对不同设备可自动适应宽度。

jQuery瀑布流插件Grid-A-Licious 81
查看详情 jQuery瀑布流插件Grid-A-Licious


好久没做CF了,这次又是打了个酱油

#include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>using namespace std;int a[105];int main(){    int n,i,sum1,sum2,sum;    while(~scanf("%d",&n))    {        sum1 = sum2 = sum = 0;        for(i = 0; i<n; i++)        {            scanf("%d",&a[i]);            sum+=a[i];            if(a[i] == 100)                sum1++;            else                sum2++;        }        if(n == 1)        {            printf("NO\n");            continue;        }        sort(a,a+n);        sum/=2;        if(sum%100!=0 || sum1%2)            printf("NO\n");        else        {            if(sum2%2 && sum1==0)                printf("NO\n");            else                printf("YES\n");        }    }    return 0;}
登录后复制


HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号