Jabber ID

判断邮箱地址格式是否正确。。一把心酸泪。。。跪11+,,看后台才过。。

注意给定的每个条件都要判断。。

char a[105];
int fun(char a)
{
if((a>='0'&&a<='9')||(a>='a'&&a<='z')||(a>='A'&&a<='Z')) return 1;
if(a=='_') return 1;
return 0;
}
int main()
{
while(~scanf("%s",a))
{
int len=strlen(a);
int f=0,k=0;
while(a[k]!='@'&&k<len) k++;//'@'的位置;
int kk=k;
while(a[kk]!='/'&&kk<len) kk++;//是否存在第三部分;
if(k==len||k>=16||k<1||kk-k>33||len-kk>17) f=1;//各部分长度;
if(!fun(a[k+1])||!fun(a[len-1])) f=1;
for(int i=0;i<k&&!f;i++) if(!fun(a[i])) f=1;//第一部分;
int num=0;
for(int i=k+1;i<kk&&!f;i++)//第二部分;
{
if(a[i]=='.')
{
num=0;
if(a[i+1]=='.') f=1;
continue;
}
if(!fun(a[i])) f=1;
num++;
if(num>16) f=1;
}
if(kk!=len)//如果存在第三部分;
{
for(int i=kk+1;i<len&&!f;i++) if(!fun(a[i])) f=1;
}
if(f) printf("NO\n");
else printf("YES\n");
}
return 0;
}

                                                   Intersection

A1x + B1y + C1 = 0,
 A2x + B2y + C2 = 0. 
 ,给定这6个系数判断交点个数。

只需特判有0个与无限个即可,剩下的都是1个。

#include<bits/stdc++.h>
using namespace std;
int a1,b1,c1,a2,b2,c2;
int judge()
{
if((a1==0&&b1==0&&c1!=0)||(a2==0&&b2==0&&c2!=0)) return 0;
int f=1;//只有0个(平行),1个(相交),-1(无限);
if((a2==0&&b2==0)||(a1==0&&b1==0)) return -1;//任意一点;
else if(a1!=0&&b1!=0)//有斜率;
{
if(a2!=0&&b2!=0)
{
if(a1*b2==a2*b1)//斜率相同
{
if(c1*b2==c2*b1) return -1;//过同一点说明重合;
else f=0;//斜率相同不过同一点说明平行;
}
}
}
else
{
if(a1==0&&b1!=0)//一条横线;
{
if(a2==0&&b2!=0)
{
if(c2*b1==c1*b2) f=-1;//过同一点;
else f=0;
}
}
else//一条竖线;
{
if(a2!=0&&b2==0)
{
if(c2*a1==c1*a2) f=-1;//过同一点;
else f=0;
}
}
}
return f;
}
int main()
{
while(~scanf("%d%d%d%d%d%d",&a1,&b1,&c1,&a2,&b2,&c2))
{
int f=judge();
printf("%d\n",f);
}
return 0;
}

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

  1. Educational Codeforces Round 21

    Educational Codeforces Round 21  A. Lucky Year 个位数直接输出\(1\) 否则,假设\(n\)十进制最高位的值为\(s\),答案就是\(s-(n\mod ...

  2. Educational Codeforces Round 21 D.Array Division(二分)

    D. Array Division time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  3. Educational Codeforces Round 21(A.暴力,B.前缀和,C.贪心)

    A. Lucky Year time limit per test:1 second memory limit per test:256 megabytes input:standard input ...

  4. Educational Codeforces Round 21 Problem E(Codeforces 808E) - 动态规划 - 贪心

    After several latest reforms many tourists are planning to visit Berland, and Berland people underst ...

  5. Educational Codeforces Round 21 Problem D(Codeforces 808D)

    Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into t ...

  6. Educational Codeforces Round 21 Problem A - C

    Problem A Lucky Year 题目传送门[here] 题目大意是说,只有一个数字非零的数是幸运的,给出一个数,求下一个幸运的数是多少. 这个幸运的数不是最高位的数字都是零,于是只跟最高位有 ...

  7. 【21.37%】【codeforces 579D】"Or" Game

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

  8. 【21.21%】【codeforces round 382D】Taxes

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

  9. 【21.58%】【codeforces 746D】Green and Black Tea

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

随机推荐

  1. EJB Timer Service is not available. Timers for application with id 95795415990861824 will not be deleted

    delete follows:glassfish\domains\domain1\applications\ejb-timer-service-appglassfish\domains\domain1 ...

  2. qconshanghai2014

    主题演讲 容器化的云——CohesiveFT首席技术官 Chris Swan 建设强大的工程师文化——Spotify工程总监 Kevin Goldsmith 软件项目变更的管理和生存之道——jClar ...

  3. 2019/05/11 JAVA虚拟机原理堆、栈、方法区概念区别

    Java堆 堆内存用于存放由new创建的对象和数组.在堆中分配的内存,由java虚拟机自动垃圾回收器来管理.在堆中产生了一个数组或者对象后,还可以在栈中定义一个特殊的变量,这个变量的取值等于数组或者对 ...

  4. 【学习笔记】HTML position(static、fixed、relative、absolute)

    [本文转载] position的四个属性值:static.fixed.relative.absolute 下面分别讲述这四个属性:<div id="parent">   ...

  5. String 截取字符串#中间的文本

    通过正则实现: String regex = "#([^#]+)#"; @Test public void test() { String text = "#中俄建交七十 ...

  6. spark性能调优--jvm调优(转)

    一.问题切入 调用spark 程序的时候,在获取数据库连接的时候总是报  内存溢出 错误 (在ideal上运行的时候设置jvm参数 -Xms512m -Xmx1024m -XX:PermSize=51 ...

  7. HYSBZ 1208 宠物收养所 (Splay树)

    题意:一家宠物收养所负责处理领养者与遗弃宠物业务,有人来领宠物,则领一只最理想的.若没有宠物了,领养者们就得等到宠物来,宠物一来立刻送给其中一个等待者.如果有两个理想的选择,则选择那个值较小的.收养所 ...

  8. iOS猜拳游戏源码

    利用核心动画和Quartz2D做的一个小游戏.逻辑十分简单. 源码下载:http://code.662p.com/<ignore_js_op> 详细说明:http://ios.662p.c ...

  9. Git搭建自己的网站服务器(Linux)

    git服务器弄了半天终于搞定了,还是记录下吧,不然下次有得忘了 流程: 服务器 构建git目录 git用户,git组作为仓库管理 ssh授权(远程无需密码接入) hook(post-receive)自 ...

  10. (转)搭建Spring4.x.x开发环境

    http://blog.csdn.net/yerenyuan_pku/article/details/52831306 先去Spring官网下载Spring4.x.x开发包(本人使用的版本是Sprin ...