Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
不知道错哪儿(请指教)#include<iostream.h> #include<cmath> int main() { int i,j,n,g; long double x,y,z,m=0.0,area=0,s=0,a[10000][3]; cin>>n; for(i=0;i<n;i++) { for(j=0;j<2;j++) { cin>>a[i][j]; } } for(i=2;i<n;i++) { x=sqrt((a[i-1][0]-a[0][0])*(a[i-1][0]-a[0][0])+(a[i-1][1]-a[0][1])*(a[i-1][1]-a[0][1])); y=sqrt((a[i][0]-a[0][0])*(a[i][0]-a[0][0])+(a[i][1]-a[0][1])*(a[i][1]-a[0][1])); z=sqrt((a[i][0]-a[i-1][0])*(a[i][0]-a[i-1][0])+(a[i][1]-a[i-1][1])*(a[i][1]-a[i-1][1])); s=(1.0/2)*(x+y+z); area=sqrt(s*(s-x)*(s-y)*(s-z)); m+=area; } // cout<<m<<endl; g=(int)m/50; cout<<g<<endl; return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator