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. MySQL修改datadir目录

    更改MySQL的数据目录由/usr/local/mysql/data/更换至/data/mysql/ 第一种方法修改my.cnf 1)关闭MySQL [root@test2 ~]# service m ...

  2. WCF 数据契约(DataContract)

    服务契约定义了远程访问对象和可供调用的方法,数据契约则是服务端和客户端之间要传送的自定义数据类型. 一旦声明一个类型为DataContract,那么该类型就可以被序列化在服务端和客户端之间传送,如下所 ...

  3. HDU 6057 Kanade's convolution

    题目链接:HDU-6057 题意: 思路:先按照官方题解推导出下面的式子: 现在唯一的问题就是怎么解决[bit(x)-bit(y)=bit(k)]的问题. 我们定义\( F(A,k)_{i}=\lef ...

  4. Django-模板继承、包含和静态文件配置

    一.模板继承 模板继承可以减少页面内容的重复定义,实现页面内容的重用 典型应用:网站的头部.尾部是一样的,这些内容可以定义在父模板中,子模板不需要重复定义 block标签:在父模板中预留区域,在子模板 ...

  5. OSGiBundle出现 Could not find bundle: org.eclipse.equinox.console的解决方案

    按照网上教程创建OSGI HelloWorld实例配置run configuration时出现Could not find bundle: org.eclipse.equinox.console 和C ...

  6. WebApi Owin SelfHost OAuth2 - 授权服务和资源服务分离方案

    使用JWT 参考:http://www.cnblogs.com/grissom007/p/6294746.html

  7. java基础52 编码与解码

    1.解码与编码的含义 编码:把看得懂的字符变成看不懂的码值,这个过程就叫编码    解码:根据码值查到相对应的字符,我们把这个过程就叫解码 注意:编码与解码时,我们一般使用统一的码表,否则非常容易出现 ...

  8. MySQL执行计划explain的key_len解析

    前言:当用Explain查看SQL的执行计划时,里面有列显示了 key_len 的值,根据这个值可以判断索引的长度,在组合索引里面可以更清楚的了解到了哪部分字段使用到了索引.下面演示中,表结构的合理性 ...

  9. 阿里百川码力APP监控 来了!

    阿里百川码力APP监控  来了!这个APP监控 和手淘一起成长历经千锤百炼 走过千BUG万坑如今百川起产品   为了让你的APP更好 用户更爽! 在移动互联网时代,一款应用是否成功,用户体验是一个关键 ...

  10. 如何验证一个地址可否使用—— MmIsAddressValid函数分析

    又是一篇内核函数分析的博文,我个人觉得Windows的内核是最好的老师,当你想实现一个功能之前可以看看Windows内核是怎么做的,说不定就有灵感呢:) 首先看下官方的注释说明: /*++ Routi ...