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. aarch64_c1

    CBFlib-0.9.5.15-3.fc26.aarch64.rpm 2017-02-06 06:55 393K fedora Mirroring Project CBFlib-devel-0.9.5 ...

  2. python hash()和hashlib

    一.哈希算法 哈希算法:哈希算法并不是特定的算法而是一类算法的统称,只要是完成这种功能的算法都是哈希算法,哈希算法也叫做散列算法.同时这个过程是不可逆的,无法由key推导出data.判断一个哈希算法是 ...

  3. HTTP之一 If-Modified-Since & If-None-Match

    If-Modified-Since & If-None-MatchIf-Modified-Since,和 Last-Modified 一样都是用于记录页面最后修改时间的 HTTP 头信息,只是 ...

  4. TF-池化函数 tf.nn.max_pool 的介绍

    转载自此大神 http://blog.csdn.net/mao_xiao_feng/article/details/53453926 max pooling是CNN当中的最大值池化操作,其实用法和卷积 ...

  5. 基于vue配置axios

    转载地址:https://juejin.im/post/5a02a898f265da43052e0c85 1.背景 在项目开发中ajax请求是必不可缺少 一部分ajax请求不需要loading或则请求 ...

  6. (二)Mybatis项目配置

    第一节:environments Mybatis支持多个环境,可以任意配置 <environments default="development"> <envir ...

  7. Linux下LAMP服务器的搭建

    1.安装并配置Apache 安装apache的方法有很多种,这里选择通过yum方式进行安装,但需要Linux系统能够连接互联网,执行如下命令,安装Apache. # yum install httpd ...

  8. COLLATE CHINESE_PRC_CI_AS_WS 的含义

    排序规则:COLLATE CHINESE_PRC_CI_AS_WS 的含义 在创建数据表时,常会用到这个. 含义当中,CHINESE_prc_ 是代表中国大陆.如果是台湾,则如:Chinese_TAI ...

  9. gtk+学习笔记(八)

    框架(Frames)可以用于在盒子中封装一个或一组构件,框架本身还可以有一个标签.标签的位置和盒子的风格可以灵活改变. 框架可以用下面的函数创建: GtkWidget *gtk_frame_new( ...

  10. 一步一步学习IdentityServer4 (2) 开始一个简单的事例

    前面将来一些配置,但是很多都不是必要的,先放一些事例需要的简要配置把 既然是IdentityServer4 所里下面的例子我 直接放到 Linux上 测试环境 CentOS 7 +Nginx1.9.3 ...