题解-python-CodeForces 227A
codeforces题目,用python写
本题输入三个点坐标,考察叉积,若大于0则right,小于0则left,等于0则towards
代码:
a = raw_input().split()
b = raw_input().split()
c = raw_input().split()
xa = int(a[0])
ya = int(a[1])
xb = int(b[0])
yb = int(b[1])
xc = int(c[0])
yc = int(c[1])
x1 = xb - xa
x2 = xb - xc
y1 = yb - ya
y2 = yb - yc
res = x1 * y2 - x2 * y1
if res > 0:
print "RIGHT"
elif res < 0:
print "LEFT"
else:
print "TOWARDS"
题解-python-CodeForces 227A的更多相关文章
- 【题解】Codeforces 961G Partitions
[题解]Codeforces 961G Partitions cf961G 好题啊哭了,但是如果没有不小心看了一下pdf后面一页的提示根本想不到 题意 已知\(U=\{w_i\}\),求: \[ \s ...
- Codeforces Round #353 (Div. 2) ABCDE 题解 python
Problems # Name A Infinite Sequence standard input/output 1 s, 256 MB x3509 B Restoring P ...
- 【题解】Codeforces Round #798 (Div. 2)
本篇为 Codeforces Round #798 (Div. 2) 也就是 CF1689 的题解,因本人水平比较菜,所以只有前四题 A.Lex String 题目描述 原题面 给定两个字符串 \(a ...
- 【题解】 Codeforces 662A Gambling Nim (线性基)
662A,戳我戳我 Solution: 我们先取\(ans=a[1] \bigoplus a[2] \bigoplus ... \bigoplus a[n]\),然后我们定义\(c[i]=a[i] \ ...
- 【题解】 Codeforces 919F A Game With Numbers(拓扑排序+博弈论+哈希)
懒得复制,戳我戳我 Solution: 我感觉我也说不太好,看Awson的题解吧. 说一点之前打错的地方: 连边存的是hash后的数组下标 if(ans[ num( C[a.hash()] , C[b ...
- 题解【CodeForces 910A The Way to Home】
题目大意 一只青蛙现在在一个数轴上,它现在要从点 \(1\) 跳到点 \(n\) ,它每次可以向右跳不超过 \(d\) 个单位.比如,它可以从点 \(x\) 跳到点 \(x+a\)(\(1\le a\ ...
- 【CodeForces 227A】Where do I Turn?叉积
题意 ABC的位置关系只有三种可能: 1.在一条直线上,输出TOWARDS A--B--C 2.AB 和BC垂直,B为直角顶点,AB左侧是C,输出LEFT C--B | A 3.AB 和BC垂直,B为 ...
- 【题解】 Codeforces Edu44 F.Isomorphic Strings (字符串Hash)
题面戳我 Solution 我们按照每个字母出现的位置进行\(hash\),比如我们记录\(a\)的位置:我们就可以把位置表示为\(0101000111\)这种形式,然后进行字符串\(hash\) 每 ...
- 【题解】 Codeforces Edu41 F. k-substrings (字符串Hash)
题面戳我 Solution 我们正着每次都要枚举从长到短,时间复杂度承受不了,但是我们可以发现一个规律,假设某次的答案为\(x\),那么这个字符串为\(A+X+B\)组成,无论中间的\(X\)是重叠还 ...
- 【题解】codeforces 467C George and Job dp
题目描述 新款手机 iTone6 近期上市,George 很想买一只.不幸地,George 没有足够的钱,所以 George 打算当一名程序猿去打工.现在George遇到了一个问题. 给出一组有 n ...
随机推荐
- python学习(22) 访问数据库
原文链接:http://www.limerence2017.com/2018/01/11/python22/ 本文介绍python如何使用数据库方面的知识. SQLite SQLite是一种嵌入式数据 ...
- scrum敏捷开发重点介绍
参考: http://www.scrumcn.com/agile/scrum-knowledge-library/scrum.html https://www.zhihu.com/question/3 ...
- day2 程序流程控制
流程控制:1.调用方法.调用方法将导致控制流程离开当前方法,转移到被调用的方法 2.选择.java中有两种做出选择的机制:if/else语句和switch语句.三目运算符可以看作是if/else的一个 ...
- memcmp 和 memcpy使用
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> ...
- charles抓包详解http 与 https
包工具多种多样,比较好使的还是Charles和Fiddler,下面就简单的介绍下HTTPS的相关原理并以Charles为例来介绍下如何抓取HTTPS协议的包 1.下载charles 可以去charle ...
- 新建springboot项目启动出错 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
错误信息入下: 2018-06-23 01:48:05.275 INFO 7104 --- [ main] o.apache.catalina.core.StandardService : Stopp ...
- ECMAScript6语法检查规范错误信息说明
项目中使用ECMAScript6的时候经查会使用语法检查,下面是常见错误信息的汇总: “Missing semicolon.” : “缺少分号.”, “Use the function form of ...
- Web API: Security: Authentication and Authority
原文地址: http://www.asp.net/web-api/overview/security/authentication-and-authorization-in-aspnet-web-ap ...
- Git为某个域名设置代理
打开Git 配置文件 vi ~/.gitconfig 添加如下配置: [http "https://github.com/"] proxy = http://127.0.0.1:1 ...
- 20145202马超 2016-2017-2 《Java程序设计》第6周学习总结
20145202马超 2016-2017-2 <Java程序设计>第6周学习总结 教材学习内容总结 进程:是一个正在执行中的程序,每一个进程都有一个执行程序,该顺序是一个执行路径,或者说是 ...