Smoke Big ACM Rookie Race e mobile tail number rating

Source: Internet
Author: User

Description


The reform and opening up in the 30 has brought about tremendous changes to China. 2011 China's mobile phone production is about 1.172 billion units a year. Mobile phone has become the basic daily necessities of the people!

Choosing a nice and well-remembered number for your phone may be a wish for many people. But the source is limited, can only be supplemented by the method of the number of paid election.

The purpose of this program is to: according to a given mobile phone tail number (4-bit), according to certain rules to score. The rules are as follows:

1. If a hyphen appears, either ascending or descending, add 5 points. For example: 5678,4321 all meet the standard of addition.

2. The first three digits are the same, or the last three digits are the same, plus 3 points. For example: 4888,6665,7777 all meet the standard of adding points. Note: 7777 because this standard is met two times, so this rule adds 6 points to it.

3. Add 1 points according to AABB or Abab mode. For example: The 2255,3939,7777 all conform to this pattern, so they are all added points. Note: 7777 because this standard is met two times, so this standard adds 2 points to it.

4. Contains: Any number in the 6,8,9, plus 1 points for each occurrence. 4326,6875,9918, for example, are eligible for the plus points standard. Of these, 6875 were added 2 points; 9918 were added 3 points.

Tail number final score is the sum of every standard bonus!

Input

The first line is an integer n (<100), which indicates how many input rows are below, followed by a set of n rows of 4-bit data, which is the cell phone tail number waiting to calculate the bonus points.

Output

N-line Integer.

Sample Input
1430450211234565437777888878787788668824242244991867898866
Sample Output
005681233511385
HINT
/**copyright (c) 2014, College of Computer and Control engineering, Yantai University *all rights reserved.* file name:. cpp* Author: Lenkidong * Completion Date: 2014    March 29 * Version number: v1.0*/#include <iostream>using namespace Std;int main () {int n,m,a,b,c,d,k;    CIN >> N;        while (n > 0) {k=0;        Cin >> m;        d = m% 10;        c = (M/10)% 10;        b = (m/100)% 10;        A = m/1000;        if ((a-b==-1) && (b-c==-1) && (c-d==-1)) k+=5;        if ((a-b==1) && (b-c==1) && (c-d==1)) k+=5;        if (a==c&&b==c) k+=3;        if (B==c&&c==d) k+=3;        if (A==b&&c==d) k+=1;        if (A==c&&b==d) k+=1; if (a==6| |        a==8| |a==9) k+=1; if (d==6| |        d==8| |d==9) k+=1; if (b==6| |        b==8| |b==9) k+=1; if (c==6| |        c==8| |c==9) k+=1;        cout<<k<<endl;    n--; } return 0;} 


My method sucks ....

Smoke Big ACM Rookie Race e mobile tail number rating

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.