http://acm.hdu.edu.cn/showproblem.php?pid=4450

侮辱人的智商的题目

代码:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<iomanip>
using namespace std;

#define LL long long
const int INF=0x5fffffff;
const double FINF=1e9;
const LL MOD=365*24*60*60;
const int N=100005;

int main()
{
    //freopen("data.txt","r",stdin);
    int n;
    while(cin>>n)
    {
        if(!n)
        break;
        int ans=0;
        for(int i=0;i<n;++i)
        {
            int tmp;
            cin>>tmp;
            ans+=tmp*tmp;
        }
        cout<<ans<<endl;
    }
    return 0;
}

 

posted on 2012-11-05 17:04  夜->  阅读(147)  评论(0编辑  收藏  举报