标签:面积 scanf div while string algo one logs sed
叉乘的性质
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 using namespace std; 6 7 int n,x[406],y[406]; 8 int ans; 9 10 int main(){ 11 freopen("areas.in","r",stdin); 12 freopen("areas.out","w",stdout); 13 scanf("%d",&n); 14 for(int i=1;i<=n;++i) 15 scanf("%d%d",&x[i],&y[i]); 16 for(int i=2;i<=n;++i) 17 ans+=(x[i-1]*y[i]-x[i]*y[i-1]); 18 ans+=(x[n]*y[1]-x[1]*y[n]); 19 printf("%d",ans/2); 20 //while(1); 21 return 0; 22 }
标签:面积 scanf div while string algo one logs sed
原文地址:http://www.cnblogs.com/A-LEAF/p/7291051.html