Rokua U6850 Phone Password

Source: Internet
Author: User

U6850 Phone PasswordTopic Background

Xiao Ming's phone set up a four-digit password, but Xiao Ming's own memory is not good, but do not want to put the password directly on the paper, so he thought of a method.

Title Description

Xiao Ming has four lines of numbers, each line of numbers have n[i] (<=250) bit, the number of the first line represents the first bit of Xiao Ming password, Xiao Ming password conversion method is this: Add this number of people on the number, you will get a new number, repeat this operation until the new number is less than 10.

N[i] not in input

input/output formatInput Format:

A total of four rows, one number per line.

output Format:

A number that represents Xiaoming's four digit password.

input/Output sampleInput Sample # #:
123456789325633432633426452634654
Sample # # of output:
9292
Description
    • Data description
123456789=1+2+3+4+5+6+7+8+9=45=4+5=932563343=3+2+5+6+3+3+4+3=29=2+9=11=1+1=226334=2+6+3+3+4=18=1+8+926452634654=2+6+4+5+2+6+3+4+6+5+4=47=4+7=11=1+1=2

Password =9292

Note: Do not want to use Int64 (long long) cheat points, real data in n[i] at least one will >20.

There are 2 n[4]<1 in the data. Do not know how Lo evaluation

#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespacestd;Chars[5][251];Long Longnum;intans[5];intMain () { for(intI=1; i<=4; i++) cin>>S[i];  for(intI=1; i<=4; i++) {num=0; intlen=strlen (S[i]);  for(intj=0; j<len;j++) Num+=s[i][j]-'0';  while(num>9){            Long Longx=num;num=0;  while(x) {num+=x%Ten; X/=Ten; }} Ans[i]=num; }     for(intI=1; i<=4; i++) cout<<ans[i];}

Rokua U6850 Phone Password

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.