Codeforces Round #284 (Div. 2) C题(计算几何)解题报告
简要题意:
给出两个点的坐标,以及一些一般直线方程Ax+B+C=0的A、B、C,这些直线作为街道,求从一点走到另一点需要跨越的街道数。(两点都不在街道上)
思路分析:
从一点到另一点必须要跨的街道等价于两点一点在这条直线一侧,另一条在另一侧。只需要将两点坐标带进去,一正一负即可。将这些直线依次检验,统计总和。
#include<stdio.h>
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
ll x1,x2,y1,y2,n,a,b,c,s,q,ans=;
scanf("%I64d%I64d",&x1,&y1);
scanf("%I64d%I64d",&x2,&y2);
scanf("%I64d",&n);
while(n--)
{
scanf("%I64d%I64d%I64d",&a,&b,&c);
s=a*x1+b*y1+c;
q=a*x2+b*y2+c;
if((s>&&q<)||(s<&&q>))
ans++;
}
printf("%I64d\n",ans);
return ;
}
Codeforces Round #284 (Div. 2) C题(计算几何)解题报告的更多相关文章
- Codeforces Round #335 (Div. 2)B. Testing Robots解题报告
B. Testin ...
- Codeforces Round #378 (Div. 2) D题(data structure)解题报告
题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常 ...
- Codeforces Round #612 (Div. 2) 前四题题解
这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...
- Codeforces Round #713 (Div. 3)AB题
Codeforces Round #713 (Div. 3) Editorial 记录一下自己写的前二题本人比较菜 A. Spy Detected! You are given an array a ...
- Codeforces Round #552 (Div. 3) A题
题目网址:http://codeforces.com/contest/1154/problem/ 题目意思:就是给你四个数,这四个数是a+b,a+c,b+c,a+b+c,次序未知要反求出a,b,c,d ...
- Codeforces Round #284 (Div. 2)A B C 模拟 数学
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring
D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Codeforces Round #257 (Div. 2) E题:Jzzhu and Apples 模拟
E. Jzzhu and Apples time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #284 (Div. 1) A. Crazy Town 计算几何
A. Crazy Town 题目连接: http://codeforces.com/contest/498/problem/A Description Crazy Town is a plane on ...
随机推荐
- HTLM5第一天的内容
网页的本质就是超级文本标记语言:Hyper Text Markup Language 网页的组成:结构(HTML) 样式(CSS) 行为(JavaScript) 万维网联盟:W3C:World W ...
- Sprint第三阶段(第四天12.12)
- Spring事务属性的介绍
Spring声明式事务让我们从复杂的事务处理中得到解脱.使得我们再也无需要去处理获得连接.关闭连接.事务提交和回滚等这些操作.再也无需要我们在与事务相关的方法中处理大量的try-catch-final ...
- Javascript学习笔记:闭包题解(4)
代码: var val1=0; var val2=0; var val3=0; for(var i1=1;i1<=3;i1++){ var i2=i1; (function(){ var i3= ...
- String.getBytes()
package entity; import java.io.UnsupportedEncodingException; public class Test { public static void ...
- arm-linux-androideabi-addr2line
./arm-linux-androideabi-addr2line -C -f -e libc.so 00040d94
- js /jquery停止事件冒泡和阻止浏览器默认事件
1>js阻止冒泡事件 var el = window.document.getElementById("a"); el.onclick = function (e) { // ...
- [原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥)
[原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥) nohacks 发表于 2016-5-29 17:12:51 https:// ...
- SSH连接超时不自动断开
Putty 启用putty keepalive putty -> Connection -> Seconds between keepalives ( 0 to turn off ),默认 ...
- sprint one
产品backlog Id Name Imp Est How to demo 1 各个角色账号登录功能 30 20 建立数据库,数据库中存储一些角色的初始账号以便测试,输入账号密码,系统在数据库中查找账 ...