题目描述

Little smart QiQi is fond of coin tossing. This day, he came to a huge field, where there's a irregular convex swamp within. Little smart QiQi didn’t want to toss the coin into the swamp, and thus, she needed to know the area of this convex. Please help her.

输入格式

The input contains several test cases, ended with EOF. In each test case, an integer N(3≤N≤100) exists first, indicating the number of vertex. The following N lines give the coordinates(x,y) of each vertex.(−106≤x,y≤106), x and y are real numbers.

输出格式

Output the area of each convex. The answer should be corrected to 1 decimal places.

输入样例

3
-1 0
0 1
1 1

输出样例

0.5

我暴力了XD

应该有更好的办法吧

顺便一提, 现在这些代码大都都是热身赛的代码直接复制过来的, 书写习惯不好比较难看 见谅- -

/*
USER_ID: test#birdstorm
PROBLEM: 146
SUBMISSION_TIME: 2014-03-11 00:38:01
*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define For(i,m,n) for(i=m;i<n;i++)
#define MAXN 105typedef struct v{double x, y;
}v;v vex[MAXN];int cmp(const void* a, const void* b)
{double xa=(*(struct v*) a).x, xb=(*(struct v*) b).x, ya=(*(struct v*) a).y, yb=(*(struct v*) b).y;double x0=vex[0].x, y0=vex[0].y;return (xa-x0)*(yb-y0)-(ya-y0)*(xb-x0)<0;
}main()
{int i, j, k, n, t;double sum=0;while(scanf("%d",&n)!=EOF){sum=0;For(i,0,n) scanf("%lf%lf",&vex[i].x,&vex[i].y);qsort(vex,n,sizeof(vex[0]),cmp);For(i,2,n) sum+=0.5*fabs((vex[i-1].x-vex[0].x)*(vex[i].y-vex[0].y)-(vex[i-1].y-vex[0].y)*(vex[i].x-vex[0].x));printf("%.1lf\n",sum);}return 0;
}

BUPT OJ146 Coin Tossing相关推荐

  1. java抛硬币,抛硬币模拟(Coin Tossing Simulation)

    摘要 腾兴网为您分享:抛硬币模拟(Coin Tossing Simulation),掌上电力,英语字典,弈玩游戏,享家等软件知识,以及手机徐静蕾字体,系统乱码,宠物圈,opengl游戏编程,京瓷220 ...

  2. 学以致用——Java源码——抛硬币(Coin Tossing)

    十年一晃而过,十年前写的代码,依然可以帮助我前进! package exercises.ch6Methods;import java.util.*;//JHTP Exercise 6.29 (Coin ...

  3. Probability Theory | Coin Tossing Problems (TBC) | 概率论中的抛硬币问题 (未完待续)

    Q1 Question: Suppose we play a game. I roll a die up to three times. Each time I roll, you can eithe ...

  4. 离散随机变量和连续随机变量_随机变量深度崩溃课程

    离散随机变量和连续随机变量 表中的内容 (Table of Content) Random Variables随机变量 Probability Distribution Functions概率分布函数 ...

  5. 判断和推论_数据科学的假设和推论

    判断和推论 数据科学经常涉及形成和检验假设.(Data Science frequently involves forming and testing hypotheses.) What will w ...

  6. Playing with Permutations(CF-252D)

    Problem Description Little Petya likes permutations a lot. Recently his mom has presented him permut ...

  7. 我的AI之路(55)--如何获取kinetics数据集和如何制作自己的kinetics数据集

    近来做行为动作识别,根据近两年的CVPR.ICCV.ECCV论文实验了一序列的动作识别方面的模型,很多都用到了kinetics数据集或者something-something数据集,但是后者的官网目前 ...

  8. f16_Automated Trading strategy_Kelly Criterion投资比_Vectorized Backtest_drawndown_value-at-risk_socket

    People worry that computers will get too smart and take over the world, but the real problem is that ...

  9. 行为识别数据集 Kinetics

    文章目录 0. 前言 1. 数据集介绍 附录-分类目录 Kinetics-400 分类 Kinetics-600 分类 Kinetics-700 分类 0. 前言 行为识别中重要的benchmark, ...

最新文章

  1. 莹石云存储卡不兼容_继入股无锡好达之后,华为再度入股国产滤波器厂商德清华莹...
  2. java zipinputstream_Java之解压流(ZipInputStream)
  3. [转]将Ubuntu默认的邮件客户端Evolution替换为Thunderbird
  4. 2015. A New Year Gift
  5. 记一次分布式B站爬虫任务系统的完整设计和实施
  6. 一个Linux下C线程池的实现(转)
  7. JAVA中的命令模式实例教程
  8. c语言函数调用排序用插入法,C语言:编写查找和排序函数(二分查找,冒泡排序,选择排序法,插入排序)...
  9. 零编程基础的我是如何在 15 岁之前仅用 9 个月开发了 9 款 App?
  10. 4n35光耦引脚图_光耦合器隔离技术在工业环境中的应用!-先进光半导体
  11. C#获取字符串中某个字符出现的次数
  12. STM32——整形变量转换为字符变量并通过串口发送出去
  13. 计算机硬故障指什么原因是,计算机常见硬故障的诊断及排除(7页)-原创力文档...
  14. Python编写三角形
  15. 没想到曾经排名第一的安全软件,如今变成无法卸载的流氓~
  16. 【技术】Leaflet 地图,惭愧惭愧
  17. Could not open the editor: URLDecoder: Illegal hex characters in escape (%) pattern - For input stri
  18. 推动前端团队基础设施建设流程方案计划书
  19. 浅谈 RISC-V 软件开发生态之 IDE
  20. C语言编写程序,从键盘输入三角形的三条边,判断它们是否能构成等腰或直角三角形。

热门文章

  1. 解决该内存不能为read或written
  2. PBR标准化工作流程
  3. 楚留香ai识别人脸_楚留香手游AI捏脸怎么弄_楚留香手游AI捏脸方法步骤_玩游戏网...
  4. 修复iPhone系统故障导致的黑屏
  5. CodeBlocks旧版下载
  6. 如何炸掉……呃,月球?
  7. ORC工具(使用阿里云统一文字识别接口实现)
  8. ubuntu 播放视频黑屏,没声音没画面,无法播放视频怎么办--已解决
  9. 构造和析构:construct,destory
  10. 从现在看未来,在未来看现在