第一次集训个人赛 T1(签到题)

一、题目

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

二、题目源代码

#include<iostream>
using namespace std;
int main()
{
    int i,n,sum,a;
    cin>>n;
    while(n)
    {
        sum=0;
        for(i=0;i<n;i++)
        {
            cin>>a;
            sum+=a*a;
        }
        cout<<sum<<endl;
        cin>>n;
    }

    return 0;
}

三、心得体会

这是一道超级无敌大水题,本来是不用写解题报告的,可是我还是必须要写一下。因为在比赛的时候,我提交了两次这道题都没有AC,可是我觉得我做的挺对的,就继续做后面的了。到最后也没有AC.

为什么?

不认真读题!我没有注意到题目中说的 可以输入多组数据

关于输入输出我还存在很大的不足,之后做题的过程中一定要注意!!

第一次集训个人赛 T1(签到题)

时间: 2024-10-13 23:13:57

第一次集训个人赛 T1(签到题)的相关文章

acm集训训练赛A题【签到题】

一.题目 Description After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of nhorizontal and m vertical sticks. An intersection point is any point on the grid which is formed by t

acm集训训练赛B题【排序+模拟】

一.原题 Description Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of ndistinct integers. Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you

Codeforces Round #429 (Div. 2) 841B Godsend(签到题)

B. Godsend Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an

XC1263 签到题(哇 ,写得我怀疑人生啊!!!@!@)

1263: 签到题 时间限制: 1 Sec  内存限制: 128 MB提交: 174  解决: 17 标签提交统计讨论版 题目描述 大家刚过完寒假,肯定还没有进入状态,特意出了一道签到题给各位dalao压压惊. 如果一个数字其中每一位都互不相同,则这个数满足要求.(如:21.10满足要求,11 不满足要求). 给出一个范围[a,b],并求出在范围内符合要求数字的数量. 输入 第一行T表示组数,T<=1000. 每一组输入一行,包含两个数字a,b.1<=a,b<=100000. 输出 对于

洛谷P3601签到题(欧拉函数)

题目背景 这是一道签到题! 建议做题之前仔细阅读数据范围! 题目描述 我们定义一个函数:qiandao(x)为小于等于x的数中与x不互质的数的个数. 这题作为签到题,给出l和r,要求求. 输入输出格式 输入格式: 一行两个整数,l.r. 输出格式: 一行一个整数表示答案. 输入输出样例 输入样例#1: 233 2333 输出样例#1: 1056499 输入样例#2: 2333333333 2333666666 输出样例#2: 153096296 说明 对于30%的数据,. 对于60%的数据,.

hpu 1695 一道签到题

一道签到题 时间限制: 2 Sec  内存限制: 128 MB 提交: 69  解决: 33 [提交][状态][讨论版] 题目描述 我想说这是一道签到题,意思就是本次测试中最水的一道,不过我这样说你真的愿意相信我吗?哈哈,题目是这样的给你一下小数,然后请告诉我分别告诉我这个小数的循环节的循环次数.循环节以及循环节长度 输入 输入包括多组测试数据每组测试数据1行,包括一个小数,小数的长度不超过200,小数大于0小于100 输出 分别输出这个小数的循环节的长度.循环节以及循环次数,中间以一个空格间隔

hdu4931 Happy Three Friends(BestCoder Round#4签到题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4931 Happy Three Friends Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 150    Accepted Submission(s): 128 Problem Description Dong-hao , Grandpa

[暑假集训]区域赛套题集

2014-07-03 [浙江第11届省赛]ZOJ 3785 What day is that day?  (打表找循环节) [暑假集训]区域赛套题集

Codeforces Round #429 (Div. 2) 841A. Generous Kefa(签到题)

A. Generous Kefa One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si - lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give o