poj2498解题报告
来源:互联网 发布:pc看图软件 谷歌 编辑:程序博客网 时间:2024/06/06 14:26
StuPId
Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 5111 Accepted: 2631
Description
Background
At DUT, the Dreamland University of Technology, all students have personal id, numbers with six or seven digits. But they're not just any numbers. Only those that have a checksum with a zero as last digit can be valid ids.
Problem
Here's how to compute the checksum of an id number. Multiply the digits from back to front (!) with repeating factors 9, 3, 7. Then simply add the products. Example:
Here the checksum is 9+21+27+0+14+21+18 = 110. The last digit is zero, so the id is valid. Sometimes students have very bad handwriting and the teaching assistents have a hard time identifying the id’s. You're asked to help in special cases, where exactly one digit is unreadable. In that case, the missing digit can be computed (there's always exactly one correct digit, thanks to 9, 3 and 7 being relatively prime to 10). Note that the students always begin concentrated and thus the first digit will always be readable (and not zero).
At DUT, the Dreamland University of Technology, all students have personal id, numbers with six or seven digits. But they're not just any numbers. Only those that have a checksum with a zero as last digit can be valid ids.
Problem
Here's how to compute the checksum of an id number. Multiply the digits from back to front (!) with repeating factors 9, 3, 7. Then simply add the products. Example:
id number : 1 3 9 0 2 7 2
factors : 9 7 3 9 7 3 9
products : 9 21 27 0 14 21 18
Here the checksum is 9+21+27+0+14+21+18 = 110. The last digit is zero, so the id is valid. Sometimes students have very bad handwriting and the teaching assistents have a hard time identifying the id’s. You're asked to help in special cases, where exactly one digit is unreadable. In that case, the missing digit can be computed (there's always exactly one correct digit, thanks to 9, 3 and 7 being relatively prime to 10). Note that the students always begin concentrated and thus the first digit will always be readable (and not zero).
Input
The first line contains the number of scenarios. Each scenario is a single line that contains an id number with one digit replaced by a question mark and with six or seven digits length.
Output
The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print a single line containing the correct id number. Terminate the output for the scenario with a blank line.
Sample Input
413?02723?5678345?78314?592
Sample Output
Scenario #1:1390272Scenario #2:335678Scenario #3:345778Scenario #4:3146592
思路:水题 看懂题意就能会做
- poj2498解题报告
- poj2498
- poj2498
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- 解题报告
- Antiprime解题报告
- expr解题报告
- 华容道解题报告
- tju解题报告
- zju1062/pku1095解题报告
- UsacoGate解题报告 --- 序曲
- ZJU 2060 解题报告
- ZJU 1331 解题报告
- AT&T汇编格式及嵌入式汇编
- HDU2386Dart Challenge题解动态规划DP
- Matlab安装有限元FEM工具箱
- 为什么我试用你们的软件,连接设备的时候会假死机?
- C语言栈的实现--学习组合设计(二)
- poj2498解题报告
- 多条记录拼接成一个字符串
- 窗体透明度为0遇到的问题
- pku 2250 Compromise(LCS)
- 机房收费系统--数据库概念结构设计
- c# sql like 参数
- 饼图、柱状图
- 函数参数中带省略号的用法
- 健康高于一切,理智大于情感,父母永远第一位