標籤:des style blog color os strong
一、題目
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
41 2 3 433 3 30
Sample Output
3027二、題目原始碼
#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.
為什嗎?
不認真讀題!我沒有注意到題目中說的 可以輸入多組資料
關於輸入輸出我還存在很大的不足,之後做題的過程中一定要注意!!