Draw Something

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2850 Accepted Submission(s): 2373

Problem Description

Wangpeng is good at drawing. Now he wants to say numbers like “521” to his girlfriend through the game draw something.

Wangpeng can’t write the digit directly. So he comes up a way that drawing several squares and the total area of squares is the number he wants to say.

Input all the square Wangpeng draws, what’s the number in the picture?

Input

There are multiple test cases.

For each case, the first line contains one integer N(1≤N≤100) indicating the number of squares.

Second line contains N integers ai(1≤ai≤100)represent the side length of each square. No squares will overlap.

Input ends with N = 0.

Output

For each case, output the total area in one line.

Sample Input

4 1 2 3 4 3 3 3 3 0

Sample Output

30 27

题意

就是给你n个数,然后让你求这N个数的前缀和

题解

就是按照题意暴力就好啦

代码

int a[maxn];
int main()
{
int n;
while(RD(n)!=-1)
{
if(n==0)
break;
LL ans=0;
REP_1(i,n)
{
RD(a[i]);
ans+=a[i]*a[i];
}
printf("%d\n",ans);
}
}

hdoj 4450 Draw Something 水题的更多相关文章

  1. HDOJ 1056 HangOver(水题)

    Problem Description How far can you make a stack of cards overhang a table? If you have one card, yo ...

  2. HDOJ(HDU) 1718 Rank(水题、、、)

    Problem Description Jackson wants to know his rank in the class. The professor has posted a list of ...

  3. hdoj 5198 Strange Class 水题

    Strange Class Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

  4. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  5. 水题 HDOJ 4727 The Number Off of FFF

    题目传送门 /* 水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错 */ #include <cstdio> #include <iostream> ...

  6. 水题 HDOJ 4716 A Computer Graphics Problem

    题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...

  7. HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)

    Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...

  8. HDOJ/HDU 1256 画8(绞下思维~水题)

    Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...

  9. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

随机推荐

  1. 我所知道的MVVM框架(转 司徒大大 )

    RubyLouvre commented on 6 Sep 2014   avalon http://avalonjs.github.io/ (使用Object.defineProperties. V ...

  2. p,br,hn,b,i,u,s,sup,sub标签

    <!--   -->注释 <p></p>段落标签 <br />换行标签 <h1></h1> 字体标签  最大 <h6> ...

  3. TCP/IP详解(整理)

    1.概述 路由器是在网络层进行联通,而网桥是在链路层联通不同的网络. IP层用ICMP来与其他主机或路由器交换错误报文和其他的重要信息.应用程序也可以访问ICMP,两个诊断工具:Ping和Tracer ...

  4. Flask小demo---代码统计系统

    功能要求: 管理员登录 # 第一天 班级管理 # 第一天 学生管理 # 第一天 学生登录 上传代码(zip文件和.py文件) 查看个人提交记录列表 highchar统计 学生列表上方使用柱状图展示现班 ...

  5. Django Rest Framework----ModelViewSet视图 ModelViewSet源码分析

    一.视图类 #bookview是一个视图类,继承自ModelViewSet class BookView(ModelViewSet): throttle_classes = [VisitThrottl ...

  6. java基础69 JavaScript产生伪验证码(网页知识)

    1.伪验证码 <!doctype html> //软件版本:DW2018版 <html> <head> <meta charset="utf-8&q ...

  7. 如何学习React--[转]

    如果你是一个 React (或者前端) 新手, 出于以下的原因, 你可能会对这个生态圈感到困惑: React 的目标群体历来是喜欢尝试新事物的开发者和前端专家. Facebook 只开源了他们在实际使 ...

  8. ZooKeeper的基本概念(二)

    第一篇博文,我们对Zookeeper有了一个简单的认识,而且比较浅显,易懂,这篇博文,我们了解它的基本概念,如下图所示: 了解它的基本概念,有助于我们后面的学习,虽然今天的文章都是概念性质的内容,但是 ...

  9. 我常用的 Python 调试工具 - 博客 - 伯乐在线

    .ckrating_highly_rated {background-color:#FFFFCC !important;} .ckrating_poorly_rated {opacity:0.6;fi ...

  10. PHP5.6中php-fpm的配置、启动、关闭和重启

    转:http://blog.csdn.net/field_yang/article/details/52401994 该文主要讲述:如何配置PHP-fpm.常见报错解决方法和php-fpm的启动.关闭 ...