A - BerOS file system

水题不解释了,压缩斜杆。要注意最后没有斜杠。

char a[105];
int main()
{
// int t,n;
while(~scanf("%s",a))
{ int len=strlen(a);
int k=len-1;
while(a[k]=='/'&&k>=0) k--;
if(k<0)
{
printf("/\n");
continue;
}
int f=0;
for(int i=0;i<k+1;i++)
{
if(a[i]=='/'&&f)
continue;
else printf("%c",a[i]);
f=0;
if(a[i]=='/') f=1;
}
printf("\n");
} return 0;
}

                                               B - Equation

Ax2 + Bx + C = 0 
  给定A,B,C判断有无根,递增输出其根。

注意无限根与无根的前提下对开方里数的进行判断即可。

int main()
{
double a,b,c;
while(~scanf("%lf%lf%lf",&a,&b,&c))
{
if(a==b&&b==c&&c==0)
{
printf("-1\n");//无限根;
continue;
}
double x=b*b-a*4*c;
if(((a==0&&b==0)&&c!=0)||x<0)
{
printf("0\n");
continue;
}
if(x==0)
{
double xx=-b/(2.0*a);
printf("1\n%.5f\n",xx);
continue;
}
if(a==0)
{
double xx=-c/b;
printf("1\n%.5f\n",xx);
continue;
}
double x1=(-b+sqrt(x))/(2.0*a);
double x2=(-b-sqrt(x))/(2.0*a);
if(x1>x2) swap(x1,x2);
if(x1==x2)
printf("1\n%.5f\n",x1);
else printf("2\n%.5f\n%.5f\n",x1,x2);
} return 0;
}

CodeForces 20 A+B的更多相关文章

  1. Codeforces Alpha Round #20 (Codeforces format) C. Dijkstra?(裸的dijkstra)

    题目链接:http://codeforces.com/problemset/problem/20/C 思路:需要用优化过的dijkstra,提供两种写法. #include <iostream& ...

  2. Educational Codeforces Round 20

    Educational Codeforces Round 20  A. Maximal Binary Matrix 直接从上到下从左到右填,注意只剩一个要填的位置的情况 view code //#pr ...

  3. 7.20 Codeforces Beta Round #8

    链接:codeforces.com/contest/8 A 原因:RE,fantasy 的字符串的长度可能大于原字符串. B 题意:上下左右走,可能要避让障碍,问是否存在一个地图使得给定的路径为当前最 ...

  4. 2018.9.20 Educational Codeforces Round 51

    蒟蒻就切了四道水题,然后EF看着可写然而并不会,中间还WA了一次,我太菜了.jpg =.= A.Vasya And Password 一开始看着有点虚没敢立刻写,后来写完第二题发现可以暴力讨论,因为保 ...

  5. Educational Codeforces Round 20 C(math)

    題目鏈接: http://codeforces.com/problemset/problem/803/C 題意: 給出兩個數n, k, 將n拆分成k個數的和,要求這k個數是嚴格遞增的,並且這k個數的g ...

  6. 【20.23%】【codeforces 740A】Alyona and copybooks

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. 【20.51%】【codeforces 610D】Vika and Segments

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. Educational Codeforces Round 20.C

    C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  9. Educational Codeforces Round 20 C 数学/贪心/构造

    C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input ...

随机推荐

  1. Unity3D中GameObject 详细介绍

    通过Hierarchy面板下的Create菜单可以手动地创建一个GameObject,它可以是一个相机,一个灯光,或者一个简单的模型,当我们要在程序里面动态地创建一个相机的时候,可以new一个Game ...

  2. P1984 [SDOI2008]烧水问题

    题目描述 把总质量为1kg的水分装在n个杯子里,每杯水的质量均为(1/n)kg,初始温度均为0℃.现需要把每一杯水都烧开.我们可以对任意一杯水进行加热.把一杯水的温度升高t℃所需的能量为(4200*t ...

  3. Some Python Tricks

    python 的包管理很不好用,理解费力,故偷懒,模块仍按文件布局,写一个合并脚本将各个模块合并输出到一个脚本文件,分别管理,合并输出,回避了加载模块的问题 f-format 仅在python 3.6 ...

  4. CF962E Byteland, Berland and Disputed Cities

    思路: http://codeforces.com/blog/entry/58869. 实现: #include <bits/stdc++.h> using namespace std; ...

  5. Web前端开发的四个阶段(小白必看)

    第一阶段:HTML的学习 超文本标记语言(HyperText Mark-up Language 简称HTML)是一个网页的骨架,无论是静态网页还是动态网页,最终返回到浏览器端的都是HTML代码,浏览器 ...

  6. 搭建SSM框架(聚合项目)

    parents 父工程 pom  base用户权限 jar   wms业务 jar app帮助管理 war1. parents的pom.xml文件 1.1 maven servlet3.1.0 1.2 ...

  7. synchronize早已经没那么笨重

    我发现一些同学在网络上有看不少synchronize的文章,可能有些同学没深入了解,只看了部分内容,就急急忙忙认为不能使用它,很笨重,因为是采用操作系统同步互斥信号量来实现的.关于这类的对于synch ...

  8. 毕业设计:HomeFragment(二)

    一.长按item时的响应 在长按item时,我希望能让CheckBox显示出来,并且呼出全选.反选.取消菜单,以及下载.删除.移动.复制操作菜单. 我在具体实现的时候发现处理item布局是一个很大的问 ...

  9. java实现单向链表的增、删、改、查

    单向链表 作者:vashon package com.ywx.link; /** * 单向链表 * @author vashon * */ public class LinkTest { public ...

  10. java5增加对https的支持

    jdk1.5不支持http协议,jdk1.8默认支持,比较好的解决方案是升级jdk,但是升级jdk风险极大.不能升级jdk的情况下,可以使用如下方式. 利用httpclient,进行封装,从而实现对h ...