当前位置:网站首页>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'边栏推荐
- Uploading multiple attachments from canvas apps to SharePoint
- Sword finger offer 22 The penultimate node in the linked list
- Written in eclipse, problems after querying the database connection
- 【协会通知】关于举办人工智能与物联网领域暑假专题师资培训的通知
- Advanced learning of MySQL -- Application -- Optimization of other SQL statements
- d3dx9_ How to repair 33.dll? d3dx9_ What if 33.dll is lost?
- Software testing Basics - software testing history, process, classification, benefits, limitations
- Seata server database connection user and service database undo_ What permissions do log users need?
- 428 binary tree (501. mode in binary search tree, 701. insert operation in binary search tree, 450. delete node in binary search tree, 669. prune binary search tree)
- (POJ - 1847) tram (shortest circuit)
猜你喜欢

Oracle concept II

Wechat applet map displays the current position with annotation

Unity shadow shadow pancaking

leetcode 82. Delete duplicate Element II in the sorting linked list

Asemi rectifier bridge kbp310 function pin diagram

Byte + Google super full kotlin learning King fried notes! Kotlin introductory tutorial + Advanced kotlin enhanced actual combat (with demo)

Leetcode 33. Search rotation sort array

leetcode 142. Circular linked list II

When the publish / subscribe mode encounters NET

Advanced learning of MySQL -- Application -- Optimization of other SQL statements
随机推荐
d3dx9_ How to repair 32.dll? d3dx9_ Solution to 32.dll missing
leetcode 92. Reverse linked list II
Teach you to use elastic search: run the first hello world search command
Oracle concept II
[multithreading] thread communication scheduling, waiting set wait(), notify()
[UVM foundation] UVM_ Is in agent_ Active variable definition
d3dx9_ 39.dll how to repair -d3dx9_ 39.dll missing file download
Wanzhou gold industry: what are the differences between gold t+d investment and other investments?
Set up your own website (10)
广汽三菱全新欧蓝德首次国内亮相于年内上市 产品力全面焕新
wheel ui
What do fast fashion brands care more about?
Software testing - the concept of testing, the detailed introduction of unit testing, and how to design test cases
[Tang Laoshi] C -- encapsulation: member method
Delete duplicate elements in the sorting linked list
Application practice of day13 for loop distinguish the application of traversing break continue
Handling method of occasional error reporting on overseas equipment
Use pyinstaller to package py files into exe. Precautions and error typeerror:_ get_ sysconfigdata_ name() missing 1...‘ check_ Solutions to exists'
TDengine在数控机床监控中的应用
电子智慧套装教程