当前位置:网站首页>P1055 [noip2008 popularization group] ISBN number
P1055 [noip2008 popularization group] ISBN number
2022-07-02 10:54:00 【&volume】
Title Description
Every book officially published has a ISBN The number corresponds to ,ISBN Code includes 99 Digit number 、11 Bit ID and 33 Bit separator , The format is as follows x-xxx-xxxxx-x, Symbols - It's the separator ( The minus sign on the keyboard ), The last one is the identification number , for example 0-670-82162-4 It's a standard ISBN code .ISBN The first digit of the code indicates the language of publication of the book , for example 00 For English ; First separator - The next three figures represent the publisher , for example 670670 On behalf of Viking press ; The five digits after the second separator represent the number of the book in the publishing house ; The last digit is the identification number .
The identification code is calculated as follows :
Multiply the first number by 11 Multiply the last digit by 22…… And so on , Use the results \bmod 11mod11, The remainder obtained is the identification code , If the remainder is 1010, The identification code is capital letters XX. for example ISBN number 0-670-82162-4 Identification code in 44 This is how I got : Yes 067082162 this 99 A digital , From left to right , Times, respectively, 1,2,...,91,2,...,9 And then sum up , namely 0×1+6×2+……+2×9=1580×1+6×2+……+2×9=158, And then take 158 \bmod 11158mod11 Result 44 As an identification number .
Your task is to write a program to judge the input ISBN Is the identification number correct , If correct , Only output Right; If the error , Then output what you think is correct ISBN number .
Input format
A character sequence , For a book ISBN number ( Make sure the input matches ISBN Format requirements for number ).
Output format
a line , If you type ISBN The ID of the number is correct , Then output Right, otherwise , In the prescribed form , Output correct ISBN number ( Include separator -).
I/o sample
Input #1 Copy
0-670-82162-4
Output #1 Copy
Right
Input #2 Copy
0-670-82162-0
Output #2 Copy
0-670-82162-4
explain / Tips
2008 First question of popularization group
# include <iostream>
//# include <stdlib>
using namespace std;
int main()
{
// string s;
// cin>>s;
char s[13];
for(int i=0;i<=12;i++)
{
cin>>s[i];
}
int j=1,i=0,n=0;
for(i=0;i<12;i++)
{
if(s[i]>47&&s[i]<58)
{
int a=0;
a=(int)s[i];
//printf("%d\n",a);
n=(a-48)*j+n;
++j;
}
}
if(n%11==s[12]-48||(n%11==10&&s[12]=='X'))
{
cout<<"Right";
}
else
{
// if(s[12]=='X'&&s[12])
for(int i=0;i<12;i++)
{
cout<<s[i];
}
if(n%11==10)
cout<<"X";
else
cout<<n%11;
}
}
边栏推荐
- Excuse me, is it cost-effective to insure love life patron saint 2.0 increased lifelong life insurance? What are the advantages of this product?
- [unity3d] production progress bar - make image have the functions of filled and sliced at the same time
- Jsp webshell Free from killing - The Foundation of JSP
- "Matching" is true love, a new attitude for young people to make friends
- PCL 投影点云
- 快速做出原型
- PCL 点云转深度图像
- Use WinDbg to statically analyze dump files (summary of practical experience)
- MongoDB-快速上手MongoDB命令行的一些简单操作
- How to get the password of cpolar?
猜你喜欢

HDU1228 A + B(map映射)

Flutter环境配置保姆级教程,让doctor一绿到底

Ks009 implement pet management system based on SSH

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer

Mysql database remote access permission settings

从.bag文件中读取并保存.jpg图片和.pcd点云

Disassembling Meitu SaaS: driving the plane to change the engine

Operator-1 first acquaintance with operator

Easyexcel, a concise, fast and memory saving excel processing tool

Thanos Receiver
随机推荐
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
UVM learning - object attribute of UVM phase
12.进程同步与信号量
首份中国企业敏捷实践白皮书发布| 附完整下载
js promise. all
nodejs+express+mysql简单博客搭建
Analysis of hot spots in AI technology industry
2022爱分析· 国央企数字化厂商全景报告
Considerations for Apache deploying static web page projects
Windows环境MySQL8忘记密码文件解决方案
转换YV12到RGB565图像转换,附YUV转RGB测试
Read H264 parameters from mediarecord recording
MySQL lethal serial question 3 -- are you familiar with MySQL locks?
Mysql database remote access permission settings
Flink calculates topn hot list in real time
Oracle notes
PCL 从一个点云中提取一个子集
[pit avoidance guide] pit encountered by unity3d project when accessing Tencent bugly tool
Flutter环境配置保姆级教程,让doctor一绿到底
JSP webshell免杀——webshell免杀