hdu 4450 Draw Something
2012-10-31 16:55
323 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4450
题目大意:
求出n个不重叠正方形的面积和.
题目思路:
answer=sum(a[i]*a[i]), 1<=i<=n.
面子题,全场飘球专用....
代码:
题目大意:
求出n个不重叠正方形的面积和.
题目思路:
answer=sum(a[i]*a[i]), 1<=i<=n.
面子题,全场飘球专用....
代码:
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <ctype.h> #include <math.h> #include <time.h> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <string> #include <iostream> #include <algorithm> using namespace std; #define ll long long #define ls rt<<1 #define rs ls|1 #define lson l,mid,ls #define rson mid+1,r,rs #define middle l+r>>1 typedef pair<int,int> pii; typedef multiset<int> mset; typedef multiset<int>::iterator mst_it; template <class T> T _max(T x,T y){return x>y? x:y;} template <class T> T _min(T x,T y){return x<y? x:y;} template <class T> void _swap(T &x,T &y){T z=x;x=y;y=z;} template <class T> T GCD(T a,T b){for(T t;b;t=a%b,a=b,b=t);return a;} template <class T> T LCM(T a,T b){return a/GCD(a,b)*b;} #define clr_all(x,num) memset(x,num,sizeof(x)) #define clr(x,num,sz) memset(x,num,sizeof(x[0])*(sz+1)) #define inf 0x3F3F3F3F #define eps (1e-9) #define MOD 1000000007 const double pi=acos(-1.0); const int M=500 +3; int ts,cas=0; int n,m; void run(){ int i,j,k; int res=0; while(n--){ scanf("%d",&m); res+=m*m; } printf("%d\n",res); } void preSof(){ } int main(){ //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); preSof(); //run(); while(~scanf("%d",&n) && n) run(); //for(scanf("%d",&ts),cas=1;cas<=ts;cas++) run(); return 0; }
相关文章推荐
- hdu 4450 Draw Something
- HDU-4450-Draw Something (2012年金华赛区I题)
- HDU 4450 Draw Something
- hdu 4450 Draw Something
- HDU 4450 Draw Something 2012亚洲区域赛金华现场赛I题
- hdu 4450 Draw Something
- hdu 4450 Draw Something
- HDU—— 4450 Draw Something
- HDU 4450 Draw Something
- HDU 4450 Draw Something
- Hdu 4450 - Draw Something
- hdu 4450 Draw Something(水)
- hdoj 4450 Draw Something 水题
- HDU——Draw Something
- HDU4450
- 第37届ACM/ICPC 金华赛区现场赛最水四道题 HDU 4442 Physical Examination HDU 4450 Draw Something HDU 4451 Dressing HDU 4452 Running Rabbits
- 哈理工校园编程练习赛杭电 acm 4450 B.Draw Something
- hdu 4450 (水)
- HDU-2049 不容易系列之(4)——考新郎 错排 不要用 long long
- hdu_1690