当前位置:网站首页>Contest3182 - the 39th individual training match for 2021 freshmen_ C: [string] ISBN number
Contest3182 - the 39th individual training match for 2021 freshmen_ C: [string] ISBN number
2022-06-27 18:29:00 【This question AC sleep again】

The sample input Copy
0-670-82162-4
Sample output Copy
Right//
#include<bits/stdc++.h>
using namespace std;
const int MAXN=22;
char str[MAXN];
int main()
{
int sum,cnt,ans,i;
while( ~scanf("%s",str) )
{
sum=0; cnt=1;
for( i=0;cnt!=10;i++ )
{
if( isdigit( str[i] ) )
{
sum+=( str[i]-'0' )*cnt;
cnt++;
}
}
ans=sum%11;
if( ans==10 ) // 1-000-00001-1
{
if( str[12]=='X' ) printf("Right\n");
else { str[12]='X'; printf("%s\n",str); }
}
else if( ans+'0'==str[12] ) printf("Right\n");
else { str[12]=ans+'0'; printf("%s\n",str); }
}
return 0;
}//
find:
01
9 1 3 == 13
0~12
02 Special judgement 'X'边栏推荐
- JS event binding and common events
- 黑马程序员-软件测试基础班-02-30-45工具代开浏览器运行代码,音、视频、测试点,音视频标签,布局标签。超链接语法进阶,绝对路径,相对路径
- [Tang Laoshi] C -- encapsulation: member method
- Ten common methods of arrays tools
- LACP details
- [UVM foundation] can only be used in build_ Research on executing instantiation action in phase
- 2/14 preliminary calculation geometry
- 软件测试-测试的概念,单元测试的详细介绍,如何设计测试用例
- Use lamda expression and stream flow to traverse map and list
- Delete duplicate elements in the sorting linked list
猜你喜欢

Repeatedly recognized by authoritative organizations! Smartbi was selected into the top three lists of high-tech and high growth enterprises

【协会通知】关于举办人工智能与物联网领域暑假专题师资培训的通知

Unity shadow shadow pancaking

Synchronization mechanism of dual namenodes

Community sharing jumpserver in the eyes of senior open source users: a fortress machine for "Crazy" iteration

广汽三菱全新欧蓝德首次国内亮相于年内上市 产品力全面焕新

Leetcode 5. Longest Palindromic Substring

如何提升IT电子设备效能管理

TP5 restrict access frequency

Ping An technology's practice of migrating from Oracle to ubisql
随机推荐
(POJ - 1847) tram (shortest circuit)
建立自己的网站(10)
LeetCode 124. Binary tree maximum path sum - binary tree series question 8
After the number length of Oracle exceeds 19, the entity uses long mapping. Why does this cause problems?
Set up your own website (10)
Application practice of day13 for loop distinguish the application of traversing break continue
时序数据库(Time Series Database)的存储引擎要想做到极致,还得自研
实现时序数据库(Time Series Database)在特定场景下“远超”通用数据库的难点
Awk determines whether the first column is greater than 1. If it is greater than 1, the row will be printed
2022 Liaoning latest fire facility operator simulation test question bank and answers
The European unified charging specification act was passed before the end of the year, and it is planned to expand to products such as laptop and keyboard
On array-_-
Part 32 supplement (32) string of ECMAScript
Lvgl8.x migrating to stm32f4
Oracle的NUMBER长度超过19之后,实体使用Long映射,导致出现问题是为什么?
时间序列数据的特点
Software testing learning - dark horse programmer, software testing learning outline
Application of scaleflux CSD 2000 in Ctrip
ansible环境安装及数据恢复
Android kotlin learning