题目链接

https://www.patest.cn/contests/gplt/L1-016

AC代码

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <cstdlib>
#include <ctype.h>
#include <numeric>
#include <sstream>
using namespace std;

typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
int vis[] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char c[] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
bool f(string s)
{
    int num = 0;
    int len = s.size();
    for (int i = 0; i < len - 1; i++)
    {
        num += (s[i] - '0') * vis[i];
        num %= 11;
    }
    if (s[len - 1] == c[num])
        return false;
    return true;
}

int main()
{
    int n;
    cin >> n;
    string s;
    int flag = 1;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        if (f(s))
        {
            cout << s << endl;
            flag = 0;
        }
    }
    if (flag)
        cout << "All passed\n";
}

PAT 天梯赛 L1-016. 查验身份证 【水】的更多相关文章

  1. PAT 天梯赛 L1-047. 装睡 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-047 AC代码 #include <iostream> #include <cstdio&g ...

  2. PAT 天梯赛 L1-042. 日期格式化 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-042 AC代码 #include <iostream> #include <cstdio&g ...

  3. PAT 天梯赛 L1-041. 寻找250 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-041 AC代码 #include <iostream> #include <cstdio&g ...

  4. PAT 天梯赛 L1-022. 奇偶分家 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-022 AC代码 #include <iostream> #include <cstdio&g ...

  5. PAT 天梯赛 L1-014. 简单题 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-014 AC代码 #include <iostream> #include <cstdio&g ...

  6. PAT 天梯赛 L1-012. 计算指数 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-012 AC代码 #include <iostream> #include <cstdio&g ...

  7. PAT 天梯赛 L1-010. 比较大小 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-010 AC代码 #include <iostream> #include <cstdio&g ...

  8. PAT 天梯赛 L1-007. 念数字 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-007 AC代码 #include <iostream> #include <cstdio&g ...

  9. PAT 天梯赛 L1-004. 计算摄氏温度 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-004 AC代码 #include <iostream> #include <cstdio&g ...

  10. PAT 天梯赛 L1-028. 判断素数 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-028 AC代码 #include <iostream> #include <cstdio&g ...

随机推荐

  1. C++ 抽象类二(抽象类的基本语法)

    //抽象类的基本语法 #include<iostream> using namespace std; /* 有关多继承的说明 被实际开发经验抛弃的多继承 工程开发中真正意义上的多继承是几乎 ...

  2. Data Collection

    众所周知,计算机领域论文是要以实验为基础的,而实验的原料就是数据.不管是在图像,文字或者语音领域,开源的数据都十分宝贵和重要.这里主要收集各领域的一些常用的公开数据集. 计算机视觉: [ImageNe ...

  3. 在项目中用过Spring的哪些方面?及用过哪些Ajax框架?

    在项目中用过Spring的哪些方面?及用过哪些Ajax框架? 解答:在项目使用过Spring IOC ,AOP,DAO,ORM,还有上下文环境. 在项目使用过Ext,Juery等Ajax框架.

  4. 目标跟踪之卡尔曼滤波---理解Kalman滤波的使用

    http://www.cnblogs.com/jcchen1987/p/4371439.html

  5. Android中的ACCESS_MOCK_LOCATION权限使用Demo

    转载地址:http://mobiarch.wordpress.com/2012/07/17/testing-with-mock-location-data-in-android/ The DDMS t ...

  6. ChemDraw 15.1 Pro插入阿尔法可以这样做

    在理工科学科学习过程中,大家都会遇到各种希腊字母,而阿尔法(α)又是最常见的一个.最新版本ChemDraw 15.1 Pro的功能更加卓越,在很多功能上都进行了优化,操作更简便.其中,就可以很好的在公 ...

  7. Java知识点梳理——多态

    1.定义:多态是同一个行为具有多个不同表现形式或形态的能力,即一个接口不同的实例执行不同的操作: 2.优点:消除类型之间的耦合关系.可替换性.可扩展性.接口性.灵活性.简化性: 3.多态存在的3个必要 ...

  8. python之list去重

    问题就是对一个list中的新闻id进行去重,去重之后要保证顺序不变. 直观方法 最简单的思路就是: 复制代码代码如下: ids = [1,2,3,3,4,2,3,4,5,6,1]news_ids = ...

  9. python中的json和pickle

    author:headsen chen date::2018-04-10  09:56:54 json模块和pickle模块: 这是用于序列化的两个模块: 概念介绍:json和pickle模块是将数据 ...

  10. zookeeper 事务日志与快照日志

    zookeeper日志各类日志简介 zookeeper服务器会产生三类日志:事务日志.快照日志和log4j日志. 在zookeeper默认配置文件zoo.cfg(可以修改文件名)中有一个配置项data ...