C. Meme Problem
链接
[http://codeforces.com/contest/1076/problem/C]
题意
a+b=d and a⋅b=d. 计算出a和b
分析
ab=a(d-a)=d
aa-ad+d=0; 先判断再直接求根公式
代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int t,d;
cin>>t;
while(t--){
cin>>d;
if(d*d-4*d<0) cout<<"N\n";
else{
cout<<"Y\n";
double a=(d*1.0-sqrt(d*d-4*d))/2.0,b=(d*1.0+sqrt(d*d-4*d))/2.0;
printf("%.9f %.9f\n",a,b);
}
}
return 0;
}
C. Meme Problem的更多相关文章
- CF1076C Meme Problem 数学
Try guessing the statement from this picture: You are given a non-negative integer d . You have to f ...
- Codeforces 1288B - Yet Another Meme Problem
题目大意: 令conc(a,b)函数得出的结果为将ab拼接得到的数字. 例如:conc(12,23)=1223 a和b不会包括前导0! 接下来,你已知A和B,问有多少对的(a,b)满足 1≤a≤A , ...
- Educational Codeforces Round 54 (Rated for Div. 2) Solution
A - Minimizing the String solved 题意:给出一个字符串,可以移掉最多一个字符,在所有可能性中选取一个字典序最小的. 思路:显然,一定可以移掉一个字符,如果移掉的字符的后 ...
- Educational Codeforces Round 54 (Rated for Div. 2) ABCD
A. Minimizing the String time limit per test 1 second memory limit per test 256 megabytes Descriptio ...
- codeforces1076 A.B.C.D.E
1076A 1076B 1076C 1076D 1076D A. Minimizing the String You are given a string s consisting of n low ...
- CoderForces Round54 (A~E)
ProblemA Minimizing the String 题目链接 题解:这一题读完题就写了吧.就是让你删除一个字母,使得剩下的字符组成的字符串的字典序最小:我们只要第一个当前位置的字符比下一个字 ...
- Codeforces Educational Codeforces Round 54 题解
题目链接:https://codeforc.es/contest/1076 A. Minimizing the String 题意:给出一个字符串,最多删掉一个字母,输出操作后字典序最小的字符串. 题 ...
- Educational Codeforces Round 80 (Rated for Div. 2)
A. Deadline 题目链接:https://codeforces.com/contest/1288/problem/A 题意: 给你一个 N 和 D,问是否存在一个 X , 使得 $x+\lce ...
- Educational Codeforces Round 80 (Rated for Div. 2)部分题解
A. Deadline 题目链接 题目大意 给你\(n,d\)两个数,问是否存在\(x\)使得\(x+\frac{d}{x+1}\leq n\),其中\(\frac{d}{x+1}\)向上取整. 解题 ...
随机推荐
- Java jni字符串转换
1.jstring转QString 对于Qt5.2以上(含)可以用QAndroidJniObject::toString(),详见这里:https://stackoverflow.com/questi ...
- MySQL使用索引的场景分析、不能使用索引的场景分析
一.MySQL中能够使用索引的典型场景 1.匹配全值.对索引中的列都有等值匹配的条件.即使是在and中,and前后的列都有索引并进行等值匹配. 2.匹配值的范围查询,对索引的值能够进行范围查找. 3. ...
- 13LaTeX学习系列之---LaTeX插入表格
目录 目录 前言 (一)插入表格的基础语法 1.说明 2.源代码 3.输出效果 (二)查看文档 目录 本系列是有关LaTeX的学习系列,共计19篇,本章节是第13篇. 前一篇:12LaTeX学习系列之 ...
- Apha冲刺! Day2 - 砍柴
Alpha冲刺! Day2 - 砍柴 今日已完成 晨瑶:没做和主项目相关的事情,除了教队友用gitkraken. 昭锡:学习LitePal对数据库进行操作. 永盛:切换 API 管理平台,继续撰写 A ...
- [Eclipse+PyDev]ImportError: DLL load failed:找不到指定的模块 解决方案
1. 环境 Eclipse 4.4.2 Python 3.5 Window 8.1 2. 问题 在代码中import numpy时,提示 " ImportError: DLL load fa ...
- SpringMVC 使用JSR-303进行校验 @Valid
注意:1 public String save(@ModelAttribute("house") @Valid House entity, BindingResult result ...
- cocos2d-x3.0 Vector和Map简单使用
Vector<Node*> vec; auto node1 = Node::create(); node1->setTag(1); vec.pushBack(node1); auto ...
- 基于canvas图像处理的图片 灰色图像
图片展示网页往往色彩繁杂,当一个网页上有多张图片的时候用户的注意力就很不容易集中,而且会造成网站整个色调风格的不可把控. 能不能把所有的预览图变成灰度图片,等用户激活某张图片的时候再上色呢? 以前,唯 ...
- SQL的各种连接Join详解
SQL JOIN 子句用于把来自两个或多个表的行结合起来,基于这些表之间的共同字段. 最常见的 JOIN 类型:SQL INNER JOIN(简单的 JOIN).SQL LEFT JOIN.SQL ...
- ceph 集群故障恢复
集群规划配置 master1 172.16.230.21master2 172.16.230.22master3 172.16.230.23node1 172.16.230.26node2 ...