codeforces A. Vasily the Bear and Triangle 解题报告
题目链接:http://codeforces.com/problemset/problem/336/A
好简单的一条数学题,是8月9日的。比赛中没有做出来,今天看,从pupil变成Newbie了,那个伤心啊~~~~不是分数的缘故,而是心态!!!昨晚一直卡机,网页很久才打得开,35min才进入比赛页面,接着做的时候又非常浮躁,静不下心来,提交时再次卡机,临20多min才提交成功,于是罢想!!心态真不好!!!这是第一次做题做得那么糟糕,要端正心态才行,遇到什么紧急情况都要冷静,保持清醒的头脑。
题意不难,以原点、X轴和Y轴各取一点,围成一个等腰直角三角形。当然,过X轴和Y轴的点的那条线段(假设是y = kx+b)要经过输入的坐标点,这个是约束条件。另外输出时要注意X较小的坐标点要先输出。
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std; int main()
{
int x, y, y1, x2;
while (scanf("%d%d", &x, &y) != EOF)
{
if (x < && y < || (x > && y > )) // 斜率K = -1
{
y1 = x + y;
x2 = y1;
if (x2 < )
printf("%d 0 0 %d\n", x2, y1);
else
printf("0 %d %d 0\n", y1, x2);
}
else // 斜率K = 1
{
y1 = y - x;
x2 = -y1;
if (x2 < )
printf("%d 0 0 %d\n", x2, y1);
else
printf("0 %d %d 0\n", y1, x2);
}
}
return ;
}
codeforces A. Vasily the Bear and Triangle 解题报告的更多相关文章
- codeforces C. Vasily the Bear and Sequence 解题报告
题目链接:http://codeforces.com/problemset/problem/336/C 题目意思:给出一个递增的正整数序列 a1, a2, ..., an,要求从中选出一堆数b1, b ...
- 【LeetCode】120. Triangle 解题报告(Python)
[LeetCode]120. Triangle 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址htt ...
- codeforces 336D Vasily the Bear and Beautiful Strings(组合数学)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Vasily the Bear and Beautiful Strings Vas ...
- codeforces 336C Vasily the Bear and Sequence(贪心)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Vasily the Bear and Sequence Vasily the b ...
- Codeforces Round #195 (Div. 2) A. Vasily the Bear and Triangle
水题,注意数据范围即可 #include <iostream> #include <algorithm> #include <utility> using name ...
- codeforces B. Bear and Strings 解题报告
题目链接:http://codeforces.com/problemset/problem/385/B 题目意思:给定一条只有小写英文组成的序列,需要找出至少包含一个“bear”的单词的子序列个数.注 ...
- cf A. Vasily the Bear and Triangle
http://codeforces.com/contest/336/problem/A #include <cstdio> #include <cstring> #includ ...
- CF336A Vasily the Bear and Triangle 题解
Content 一个矩形的顶点为 \((0,0)\),其对顶点为 \((x,y)\),现过 \((x,y)\) 作直线,分别交 \(x\) 轴和 \(y\) 轴于 \(A,B\) 两点,使得 \(\t ...
- codeforces 336D. Vasily the Bear and Beautiful Strings 组合数学 dp
题意: 给出n,m,g,求好串的个数 0 <= n,m <= 10^5,n + m >= 1,0 <= g <= 1 好串的定义: 1.只由0,1组成,并且恰好有n个0, ...
随机推荐
- 【转】Eclipse下导入外部jar包的3种方式
我们在用Eclipse开发程序的时候,经常要用到第三方jar包.引入jar包不是一个小问题,由于jar包位置不清楚,而浪费时间.下面配图说明3种Eclipse引入jar包的方式. 1.最常用的普通 ...
- BZOJ-1822 Frozen Nova 冷冻波 计(jie)算(xi)几何+二分+最大流判定+经典建图
这道逼题!感受到了数学对我的深深恶意(#‵′).... 1822: [JSOI2010]Frozen Nova 冷冻波 Time Limit: 10 Sec Memory Limit: 64 MB S ...
- js阻止表单重复提交
//校验表单的数据 function newFatherModuleVerify() { var moduelName = $('#fatherModule_moduelName').val(); a ...
- Spring MVC实现防止表单重复提交(转)
Spring MVC拦截器+注解方式实现防止表单重复提交
- 采用post的方式提交数据
1)说明:
- lnux下源码安装MySQL 5.6
nux下源码安装MySQL 5.6 说明:本文是我自己测试的MySQL5.6源码安装,经本人亲自实践,完全可用,另在5.6之前的版本也是可以按照本文源码安装的.我是在两台linux下一台安装5.5,另 ...
- Hibernate配置问题
Hibernate是对持久化对象操作,生成SQL语句达到操作数据库目的. 1.Hibernate可以通过两种方式来配置 (1).hibernate.cfg.xml,在此文件里hibernate-con ...
- 解决:[INS-20802] Oracle Net Configuration Assistant failed
在linux 中安装Oracle 11G 的时辰呈现 [INS-20802] Oracle Net Configuration Assistant failed 是oracle数据库的鼓掌,须要补丁p ...
- Center os FTP配置
原文:http://www.aicoffees.com/itshare/412261137.html
- Lex和Yacc入门
Lex和Yacc入门 标签: lexyacc 2013-07-21 23:02 584人阅读 评论(0) 收藏 举报 分类: Linux(132) 原文地址:http://coanor.blog ...