3415 - IMEI’s Last Digit 3415 - IMEI’s Last Digit 3415 - IMEI’s Last Digit

Statistics Sub: 181 | AC: 113 | AC%: 62,43 | Score: 1,46
Created by Luis Manuel Díaz Barón
Added by luismo (2015-11-23)
Limits
Total Time: 1000 MS |Memory: 512 MB | Output: 64 MB | Size: 9 KB
Enabled languages
Available in

Description

The IMEI (International Mobile Equipment Identity) is a written code on each cellphone which allows it to be uniquely identify through all the world. It can be usually found on the back of the device just below the battery.
Each IMEI has 15 digits distributed like this:
- the first 6 digits indicate the country where the phone was built
- the next 2 digits represent the factory where it was built
- the next 6 digits are the serial number of the cellphone
- and the last digit is used to verify if the IMEI is correct.
To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.
Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:
1 - take each digit in an odd position and replace it by its duplicated value.
2 - sum all the digits involved in the modified sequence
3 - find the remainder of dividing the sum by 10
4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.
Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??
The IMEI (International Mobile Equipment Identity) is a written code on each cellphone which allows it to be uniquely identify through all the world. It can be usually found on the back of the device just below the battery.
Each IMEI has 15 digits distributed like this:
- the first 6 digits indicate the country where the phone was built
- the next 2 digits represent the factory where it was built
- the next 6 digits are the serial number of the cellphone
- and the last digit is used to verify if the IMEI is correct.
To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.
Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:
1 - take each digit in an odd position and replace it by its duplicated value.
2 - sum all the digits involved in the modified sequence
3 - find the remainder of dividing the sum by 10
4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.
Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??
The IMEI (International Mobile Equipment Identity) is a written code on each cellphone which allows it to be uniquely identify through all the world. It can be usually found on the back of the device just below the battery.
Each IMEI has 15 digits distributed like this:
- the first 6 digits indicate the country where the phone was built
- the next 2 digits represent the factory where it was built
- the next 6 digits are the serial number of the cellphone
- and the last digit is used to verify if the IMEI is correct.
To find out the corresponding last digit one must follow a simple algorithm commonly known as Algorithm Modulo 10 or Luhn's Algorithm.
Given the first 14 digits of some IMEI enumerated from 0 to 13, the algorithm is as follows:
1 - take each digit in an odd position and replace it by its duplicated value.
2 - sum all the digits involved in the modified sequence
3 - find the remainder of dividing the sum by 10
4 - if the resulting number is greater then zero then IMEI's last digit is 10 less that number, otherwise is zero.
Now given the first fourteen digits of a single IMEI code. Can you help us find the last one ??

Input specification

A single integer T (1 <= T <= 1000) the number of test cases

The next T lines contain exactly fourteen consecutive integers representing a single IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

A single integer T (1 <= T <= 1000) the number of test cases

The next T lines contain exactly fourteen consecutive integers representing a single IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

A single integer T (1 <= T <= 1000) the number of test cases

The next T lines contain exactly fourteen consecutive integers representing a single IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

Output specification

For each case print the last digit of the corresponding IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

For each case print the last digit of the corresponding IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

A single integer T (1 <= T <= 1000) the number of test cases

The next T lines contain exactly fourteen consecutive integers representing a single IMEI code

;jsessionid=B5D034A89B5EB0A91015C74551FB58F5

Sample input

2
35242103421555
35196605023935

Sample output

0
6

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 3376 | 2769 | 1873 | 2441 | 2534 | 2141