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. js删除最后一个字符

    在最近做一个系统,使用socket来完成后台操作,C#来完成前端操作.但是在定的协议里面,一定要用某个符号来表示传的数据结束.后台进行交互时,获取到的数据必须进行删除最后一个字符的操作. 比如我们协议 ...

  2. VS配置本地IIS以域名访问

    1.IIS下配置自己的网站,添加主机名 2.修改hosts文件(C://Windows/System32/drivers/etc) 3.VS中配置项目Web服务器(选择外部主机)

  3. 多线程wait和notify实现1212

    package threadT; public class ThreadMain { public static void main(String args[]) { final Object obj ...

  4. Java子类与父类方法的隐藏和覆盖

    class Base{     int x = 1;     static int y = 2;     String name(){         return "mother" ...

  5. C# 移动开发 MasterDetailPage 关闭时报错问题

    至上次发表的 MasterDetailPage界面做主App,折腾10天,终于知道问题所在.. 泪奔的是解决这个问题只要一句代码 在MainActivity.cs里 [Activity(Label = ...

  6. UVA 11922 Permutation Transformer (Splay树)

    题意: 给一个序列,是从1~n共n个的自然数,接下来又m个区间,对于每个区间[a,b],从第a个到第b个从序列中分离出来,翻转后接到尾部.输出最后的序列. 思路: 这次添加了Split和Merge两个 ...

  7. 洛谷 U10206 Cx的治疗

    题目背景 「Cx的故事」众所周知,Cx是一个宇宙大犇.由于Cx在空中花园失足摔下,导致他那蕴含着无穷智慧的大脑受到了严重的损伤,许多的脑神经断裂.于是,Cx的wife(有么?)决定请巴比伦最好的医师治 ...

  8. php-PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'xxx.so' in Unknown on line 0

    关于xxx.so,今天在安装php的模块时候老是报,xxx.so的问题,虽然不影响使用,但作为一名当年的程序员强迫症患者,誓死要把 他搞清楚,后面发现是删除了也没有影响,因为在安装php的时候已经将他 ...

  9. nginx 新手入门

    Nginx 是一个高性能的http 和反向代理服务器,也是一个代理服务器. Nginx比Apache 更加轻量级,占用的资源少,抗并发,二apache是阻塞型的,在高并发下,nginx更占优势. 我们 ...

  10. cmd命令002

    cd..--> 返回上一级目录 cd\ --> 返回根目录"cd /d e:"--> 将当前盘符切换到e盘,"cd users/admin"- ...