题目链接: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. BZOJ-1477 青蛙的约会 拓展欧几里德

    充权限之前做的...才来交 1477: 青蛙的约会 Time Limit: 2 Sec Memory Limit: 64 MB Submit: 369 Solved: 233 [Submit][Sta ...

  2. BZOJ1202 狡猾的商人

    HNOI2005 Day1 T4 Description 刁姹接到一个任务,为税务部门调查一位商人的账本,看看账本是不是伪造的.账本上记录了n个月以来的收入情况,其中第i 个月的收入额为Ai(i=1, ...

  3. POJ3749 破译密码

    Description 据说最早的密码来自于罗马的凯撒大帝.消息加密的办法是:对消息原文中的每个字母,分别用该字母之后的第5个字母替换(例如:消息原文中的每个字母A都分别替换成字母F).而你要获得消息 ...

  4. 洛谷P2014 TYVJ1051 选课

    题目描述 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习.现在有N门功课,每门课有个学分,每门课有一 ...

  5. Emgu学习之(一)——Emgu介绍

    OpenCV“OpenCV是一个开源的计算机视觉库.OpenCV采用C/C++语言编写,可以运行在Linux/Windows/Mac等操作系统上.OpenCV还提供了Python.Ruby.MATLA ...

  6. android源代码提示文本框还能输入多少个字符

    public class TestAndroidActivity extends Activity { /** Called when the activity is first created. * ...

  7. C# 获取文件MD5校验码

    using System; using System.IO; using System.Security.Cryptography; using System.Text; public class M ...

  8. 新浪微博客户端(1)-实现Tabbar导航栏效果

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launc ...

  9. (转)也谈基于NodeJS的全栈式开发(基于NodeJS的前后端分离)

    原文链接:http://ued.taobao.org/blog/2014/04/full-stack-development-with-nodejs/ 随着不同终端(pad/mobile/pc)的兴起 ...

  10. HttpWatch详解

    一 概述: HttpWatch强大的网页数据分析工具.集成在Internet Explorer工具栏.包括网页摘要.Cookies管理.缓存管理.消息头发送/接受.字符查询.POST 数据和目录管理功 ...