题目链接: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 解题报告的更多相关文章

  1. codeforces C. Vasily the Bear and Sequence 解题报告

    题目链接:http://codeforces.com/problemset/problem/336/C 题目意思:给出一个递增的正整数序列 a1, a2, ..., an,要求从中选出一堆数b1, b ...

  2. 【LeetCode】120. Triangle 解题报告(Python)

    [LeetCode]120. Triangle 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址htt ...

  3. codeforces 336D Vasily the Bear and Beautiful Strings(组合数学)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Vasily the Bear and Beautiful Strings Vas ...

  4. codeforces 336C Vasily the Bear and Sequence(贪心)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Vasily the Bear and Sequence Vasily the b ...

  5. Codeforces Round #195 (Div. 2) A. Vasily the Bear and Triangle

    水题,注意数据范围即可 #include <iostream> #include <algorithm> #include <utility> using name ...

  6. codeforces B. Bear and Strings 解题报告

    题目链接:http://codeforces.com/problemset/problem/385/B 题目意思:给定一条只有小写英文组成的序列,需要找出至少包含一个“bear”的单词的子序列个数.注 ...

  7. cf A. Vasily the Bear and Triangle

    http://codeforces.com/contest/336/problem/A #include <cstdio> #include <cstring> #includ ...

  8. CF336A Vasily the Bear and Triangle 题解

    Content 一个矩形的顶点为 \((0,0)\),其对顶点为 \((x,y)\),现过 \((x,y)\) 作直线,分别交 \(x\) 轴和 \(y\) 轴于 \(A,B\) 两点,使得 \(\t ...

  9. 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, ...

随机推荐

  1. Android4.4中不能发送SD卡就绪广播

    当在Android上进行图片的扫描功能开发时一般会使用:sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(“file:// ...

  2. 16.(转) Android之Support v4、v7、v13的区别和应用场景

    我们在项目中经常会碰到Android Support v4.v7和v13包兼容问题,所以有必要梳理下这些东西. google提供了Android Support Library package 系列的 ...

  3. BZOJ 3110 [Zjoi2013]K大数查询

    Description 有N个位置,M个操作.操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c 如果是2 a b c形式,表示询问从第a个位置到第b个位 ...

  4. shopex商城的部署和安装

    1.在网站上下载最新的压缩包: 2.shopex是商业软件,不开源,且源代码是加密的! 3.如果你出现zend的错误,是因为你的php环境没有安装此插件,推荐使用phpstudy最新版本,我使用的ph ...

  5. Opencv显示图片并监听鼠标坐标

    #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include & ...

  6. event.keycode值大全

    window.event.keycode-获取按下的键盘值   event.keycode值大全1 keycode 8 = BackSpace BackSpace 2 keycode 9 = Tab ...

  7. 批处理:echo的用法

    批处理:echo的用法 若要用 echo 命令显示一条命令,可用下述语法:  echo [message] 参数 ON|OFF   指定是否允许命令的回显.若要显示当前的 ECHO 的设置,可使用不带 ...

  8. 将对象转为数组方法:延伸array_map函数在PHP类中调用内部方法

    public static function objectToArray($d) { if (is_object($d)) { $d = get_object_vars($d); } if (is_a ...

  9. jquery设置和获得checkbox选中问题

    1.设置checkbox选中: //选中多选框 checkbox=$("#agentinfo input[name='veri[]']"); //循环多选框中的值 checkbox ...

  10. Js注册等待

    <为维护网上公共秩序和社会稳定,请您自觉遵守以下条款: <br> <br>  一.不得利用本站危害国家安全.泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用 ...