博客
关于我
PTA团队程序设计天梯赛 | L1-016 查验身份证 (15分)
阅读量:113 次
发布时间:2019-02-26

本文共 1092 字,大约阅读时间需要 3 分钟。

??????????

?????????????????????????????????????????17???????????????????

#include 
#include
#include
using namespace std;int q[17] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};char m[12] = "10X98765432";int main() { int n, i, flag = 0; char IdCard[19]; cin >> n; while (n--) { cin >> IdCard; flag = 0; for (i = 0; i < 17; i++) { if (!isdigit(IdCard[i])) { flag = 1; break; } } if (flag) { cout << IdCard; continue; } int sum = 0; for (i = 0; i < 17; i++) { sum += q[i] * (IdCard[i] - '0'); } int Z = sum % 11; if (Z < 0) Z += 11; if (m[Z] != IdCard[17]) { cout << IdCard; } } if (!flag) { cout << "All passed"; }}

?????????????????n???????????????????????????????????17?????????????????????????????????17????????????11????Z???????????????????????????????????????????

??????????????????"All passed"????????????????

转载地址:http://brcz.baihongyu.com/

你可能感兴趣的文章
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node-RED中使用JSON数据建立web网站
查看>>
Node-RED中使用node-red-browser-utils节点实现选择Windows操作系统中的文件并实现图片预览
查看>>
Node-RED中实现HTML表单提交和获取提交的内容
查看>>
Node.js 实现类似于.php,.jsp的服务器页面技术,自动路由
查看>>
node.js 怎么新建一个站点端口
查看>>
Node.js 文件系统的各种用法和常见场景
查看>>
node.js 配置首页打开页面
查看>>
node.js+react写的一个登录注册 demo测试
查看>>
Node.js中环境变量process.env详解
查看>>
Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
查看>>
Node.js的循环与异步问题
查看>>
nodejs libararies
查看>>
nodejs 运行CMD命令
查看>>
nodejs-mime类型
查看>>