Problem ID :g023. D.海加爾山之戰

New Thread

User NA

anthony950321 SendIMessage
755057

g023. D.海加爾山之戰 | From: 211.22.52.6 | Post Date:2020-11-05 12:38:50.0

//g023 
#include <iostream>          
#include <string>      
#define LEN 1000    
using namespace std;         
int main(int arge, char *argv[])       
{               
    long long int n,x=0,a[100],i;
while(cin>>n)
{
x=0;
if(n==0)break;
else
{
for(i=1;i<=n;i++) 
{
cin>>a[i];
x=x+a[i]*a[i];
}
cout<<x<<endl; 
}
}   
return 0;      
}    

 


文章類型: 一般 | Reply | Back
User Re:NA

sagit SendIMessage
sagit

g023. D.海加爾山之戰 | From: 192.168.2.108 | Post Date:2020-11-05 13:54:59.0

n 最大到 5000 


文章類型: 一般 | Reply | Back

New Thread

ZeroJudge Forum