题目链接: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. PHP Web System Optimization(undone)

    目录 . 引言 . PHP Pool . listen . Process Manage(PM) . pm.max_children . PHP DB Connection Pool(数据库连接池) ...

  2. 我对Padding Oracle Attack的分析和思考

    道哥的<白帽子讲web安全>有一章提到Padding Oracle Attack的攻击方式,据说这货在2011年的Pwnie Rewards上还被评为"最具价值的服务器漏洞&qu ...

  3. C#图片读取和保存

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. Ubuntu学习总结-06 安装 Nginx

    Nginx是由俄罗斯人(zhan dou min zu)开发的一款高性能的http和反向代理服务器,也可以用来作为邮件代理.相比较于其他的服务器,具有占用内存少,稳定性高等优势. 一 Ubuntu源码 ...

  5. CentOS 6.4 32位系统 LAMP(Apache+MySQL+PHP)安装步骤

    先来解释一下,什么是 LAMP.正如标题所言,LAMP 实际上就是 Linux.Apache.MySQL.PHP 四个名称的缩写,当然最后一个 “P” 还有其他说法是 Perl 或者 Python.不 ...

  6. structs2标签简单实用,及自定义转换器示例代码

    一.在structs.xml中配置 <structs> <package name="tagp" namespace="/test" exte ...

  7. Python socket编程之四:模拟分时图

    建立 socket,先运行服务器,再运行客户端,建立连接后服务器从本地数据库调数据一截一截地发送给客户端,客户端接受数据绘图模拟分时图 1.socket # -*- coding: utf-8 -*- ...

  8. 去除DedeCms 5.7后台版权广告链接的方法

    织梦DedeCms 5.7后台有很多的织梦官方的广告链接,下面我们来将这些广告去掉吧. 一.去处后台登陆页login.php广告链. 1.找到登录界面模板文件/dede/templets/login. ...

  9. wifi共享小工具

    MainForm.cs: using System;using System.Collections.Generic;using System.ComponentModel;using System. ...

  10. 不起眼却有大作用的 .NET功能集(转发)

    http://www.cnblogs.com/powertoolsteam/p/top15features.html 目录 1. ObsoleteAttribute2. 设置默认值属性: Defaul ...