首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
苍灵
2025年6月23日 12:09
身份证校验 题解:C++ 数组
P1722
回复 0
|
赞 2
|
浏览 140
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int num[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; int m[11]={1,0,10,9,8,7,6,5,4,3,2}; long long sum=0; if(s.length()==18){ for(int i=0;i<17;i++){ sum=sum+(s[i]-'0')*num...
13599232167
2025年3月22日 14:45
身份证校验 题解:
P1722
回复 0
|
赞 3
|
浏览 338
#include <bits/stdc++.h> using namespace std; map <int,char>mymap;//声明map变量,映射余数与校验位对应规则 void map_init()//初始化 { mymap[0]='1';mymap[1]='0'; mymap[2]='X';mymap[3]='9'; mymap[4]='8';mymap[5]='7...
zxjrheaven
2025年3月14日 11:26
身份证校验 题解:暴力,已红温(不应该是Correct吗)
P1722
回复 0
|
赞 7
|
浏览 619
#include <bits/stdc++.h> using namespace std; int weight[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; int quanzhi(string str) { int sum=0; for(int i=0;i<17;i++) { int a=str[i]-'0&...
Agnes03
2024年7月27日 11:11
身份证校验 题解:
P1722
回复 0
|
赞 45
|
浏览 1.3k
#include <bits/stdc++.h> using namespace std; int main(){ map<int,char> dict;//余数x和校验位y的对应规则 dict[0]='1';//一定要用单引号 dict[1]='0'; dict[2]='X';//注意X是大写 dict[3]='9'; dict[4]='8'; dict[5]='7'; dict[6]='6'; dict[7]='5'; dict[8]='4'; dict[9]='3'; dic...
Candour
2024年6月10日 18:37
身份证校验 (C++ ID Corrent没绷住)题解:
P1722
回复 0
|
赞 34
|
浏览 2.7k
没注意ID Corrent(ID Correct)WA一次 #include<bits/stdc++.h> using namespace std; int v[20] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; char c[20] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; int main() { string num; while(cin >...
huanghu
2024年3月21日 10:51
身份证校验 题解:身份证校验c++
P1722
回复 0
|
赞 1
|
浏览 1.2k
#include <stdio.h> #include <iostream> #include <string> #include <string.h> #include <algorithm> #include <map> using namespace std; int main() { map<int, char> myMap; myMap[0] = '1'; myMap[1] = '0'; myMap[2] = 'X'; ...
Keeshpku
2023年3月16日 17:07
注意字符转换数字还有X是大写以及 correct它拼错了.
P1722
回复 1
|
赞 16
|
浏览 3.6k
#include <iostream> #include <string> using namespace std; int main(){ string x; int quan[50] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; char yu[50] = {'1','0','X','9','8','7','6',...
lingdongyang
2024年3月18日 16:34
身份证校验 题解:
P1722
回复 0
|
赞 7
|
浏览 1.0k
#include<stdio.h> #include<string.h> int main() { char s[105]; int f[17] = { 7 ,9, 10, 5 ,8 ,4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };//前十七位的权值 while (gets(s) != NULL) { int len = strlen(s); int sum = 0;//前面权值相乘后相加 int x = 0;//余数 if (len != 18) { printf("ID Wr...
光明守护神
2024年3月7日 21:22
身份证校验 题解:C++
P1722
回复 0
|
赞 1
|
浏览 1.1k
#include<iostream> using namespace std; void error() { cout << "ID Wrong" << endl; } void corrent() { cout << "ID Corrent" << endl; } int main() { string s; while (cin >> s) { int n = s.size(); if (n != 18) error(); else ...
orderrr
2024年3月2日 17:51
身份证校验 题解:c
P1722
回复 0
|
赞 19
|
浏览 1.4k
#include <stdio.h> #include <string.h> int main() { char ch[20]; int num[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; char cnt[11] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; while (scanf("%s", ch) != EOF) { if ...
1
2
题目
身份证校验
题解数量
17
发布题解
在线答疑
热门题解
1
身份证校验 题解:
2
身份证校验 (C++ ID Corrent没绷住)题解:
3
身份证校验 题解:c
4
注意字符转换数字还有X是大写以及 correct它拼错了.
5
身份证校验 题解:
6
身份证校验 题解:暴力,已红温(不应该是Correct吗)
7
关于这道题的两个bug
8
身份证校验 题解:
9
身份证校验 题解:
10
身份证校验 题解: