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. STM32CUBEMX使用注意:

    一 注意堆栈大小,简单来说,栈空间用于局部变量空间(size=0x400一般够用),堆(size=0x200一般够用)空间用于 alloc 或者 malloc函数动态申请变量空间

  2. Netty实现WebSocket

    package com.qmtt.server; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; ...

  3. 牛人cad二次开发网站(.net)

    http://through-the-interface.typepad.com/through_the_interface/autocad_net/ http://through-the-inter ...

  4. chrome inspect出现白屏的解决方案

    点inspect后 弹出框,可是里面一片白色 PS:原效果不是这样,只是图找不到随便p的 原因可以看这个:http://www.cnblogs.com/slmk/p/7591126.html 大概意思 ...

  5. HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported问题解决

    今天创建springboot项目的时候添加完依赖启动出现了这个错误 -- :: --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ...

  6. Ubuntu系统下配置PHP支持SQLServer 2005

    最近在做一个项目,该项目的数据库是微软公司的的SQLserver ,数据库安装在另一台windows服务器上,而项目却部署在ubuntu server上.那么这样就会涉及到项目在linux上如何链接S ...

  7. 51nod 1272 最大距离

    题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题  收藏  关注 给出一个长度为N的整数数组A,对于每一个数组元素,如果他后面存在大于等 ...

  8. 如何修改站点url

    1.config目录下的config_global.php 文件,修改:$_config['cookie']['cookiedomain'] = '.xxxxx.com';2.config目录下的co ...

  9. 技术抄录_Java高级架构师教程

    1.B2C商城项目实战     2.高性能架构专题     3.架构筑基与开源框架解析专题     4.团队协作开发专题     5.微服务架构专题     6.设计模式     附上[架构资料]   ...

  10. docker 镜像仓库的安装与使用

    安装Docker Compose 解决依赖 [root@service-1 ~]# curl -L "https://github.com/docker/compose/releases/d ...