题目链接

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";
}

最新文章

  1. sql删除前导和后缀
  2. iOS开发数据库篇—SQLite常用的函数
  3. .NET向APNS苹果消息推送通知
  4. CSS padding margin border属性
  5. win7设置防火墙允许Ping与telnet
  6. OD: Vulnerability Detection
  7. 论left-pad的实现
  8. Uploadify自定义提示信息
  9. ResultSet遍历过程中修改自身数据,不会改变循环的过程
  10. Linux下JDK安装
  11. 对于Java泛型的理解
  12. Tomcat降权启动
  13. 利用模板template动态渲染jsp页面
  14. 同一台电脑同时装Oracle客户端和服务端
  15. 常用邮箱POP3 STMP服务器与端口号设置
  16. Python-接口自动化(八)
  17. 【Mybatis】MyBatis调用带有返回结果、output参数的存储过程上与ibatis的区别
  18. js的命名空间 &amp;&amp; 单体模式 &amp;&amp; 变量深拷贝和浅拷贝 &amp;&amp; 页面弹窗设计
  19. VTK中获取STL模型点的坐标以及对其进行变换
  20. wcf会话、实例化、并发

热门文章

  1. CI 异步验证
  2. 我的直播demo
  3. 与HttpSessionListener接口有关的方法是。
  4. word中使用MathType能做什么
  5. 【转载】如何升级linux上的gcc到最新版本
  6. 将list集合,元素随机打乱
  7. 如何设置,使IntelliJ IDEA智能提示忽略大小写
  8. Scala 中我们长见到=&gt; 解析下
  9. Drupal 8 提供REST服务实例
  10. 原!findbugs:NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE 和 OBL_UNSATISFIED_OBLIGATION