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. adb的含义

    ADB全名Andorid Debug Bridge. 是一个Debug工具.为何称之为Bridge呢?因为adb是一个标准的C/S结构的工具, 是要连接开发电脑和调试手机的.包含如下几个部分: 1.C ...

  2. Backbone学习记录(1)

    去年买的<基于MVC的javascript Web富应用开发>,拖到现在还没看完,作者介绍了三个MVC框架,Spine ,backbone和javascriptMVC.1和2在国内的流行度 ...

  3. 基于坐标的自动化测试神器---Total Control快速入门

    1.Total Control简单介绍 一款能够在PC上控制手机的软件,同时可以使用PC 触摸屏.鼠标.键盘, 全面操控 Android 手机,只需通过 USB 或 WiFi 连接手机至电脑,即可随时 ...

  4. 外文翻译 《How we decide》多巴胺的预言 第一节

    这是第二章的起始... 书的导言 1991年2月24日凌晨.第一与第二海军陆战队大批向北进入了沙特阿拉伯的沙漠地带,他们从这来进入科威特.这批军队是伊拉克入侵8个月以来,同盟国第一批进入科威特的部队. ...

  5. 分布式数据存储 之 Redis(二) —— spring中的缓存抽象

    分布式数据存储 之 Redis(二) -- spring中的缓存抽象 一.spring boot 中的 StringRedisTemplate 1.StringRedisTemplate Demo 第 ...

  6. Java并发——ThreadPoolExecutor线程池解析及Executor创建线程常见四种方式

    前言: 在刚学Java并发的时候基本上第一个demo都会写new Thread来创建线程.但是随着学的深入之后发现基本上都是使用线程池来直接获取线程.那么为什么会有这样的情况发生呢? new Thre ...

  7. Maximal Discount

    Description: Linda is a shopaholic. Whenever there is a discount of the kind where you can buy three ...

  8. Java随机产生中文昵称

    有时候我们注册一个网站第一次登陆系统会产生一个随机昵称供用户选择,在项目测试阶段遇到了这个问题,因为注册时没有让用户填写昵称,于是找了两种产生随机中文昵称的方法: 代码如下 package com.u ...

  9. scroll offset & client总结

    oEvent.clientX 是指鼠标到可视区左边框的距离. oEvent.clientY 是指鼠标到可视区上边框的距离. clientWidth  是指可视区的宽度. clientHeight  是 ...

  10. EXPLAIN - 显示语句执行规划

    SYNOPSIS EXPLAIN [ ANALYZE ] [ VERBOSE ] statement DESCRIPTION 描述 这条命令显示PostgreSQL规划器为所提供的语句生成的执行规划. ...