Problem Description
As we all know, the mobile phone number is a 11-bit long digital string, at the same time, as a student, you can also apply to join the campus network, if joined successfully, you will have another cornet. Suppose all the cornet is the 6+ mobile phone number of the latter 5, such as the number 13512345678 mobile phone, the corresponding cornet is 645678.
Now, if I give you a 11-bit long mobile phone number, can you find the corresponding cornet?
Input
The first line of the input data is an n (n <= 200), which indicates that there are n data, and the next n rows each behave as a 11-bit mobile number.
Output
The output should include n rows, each containing a corresponding cornet, and the output should be in the same order as the input.
Sample Input
21351234567813787654321
Sample Output
645678654321
HINT
If a string is used, it is recommended to read in scanf ("%s").
My Code:
1#include <iostream>2 using namespacestd; 3 intMain ()4 { 5 intN; 6Cin>>N; 7 while(n--){ 8 Chara[ One]; 9Cin>>A; Tencout<<'6'; One for(intI=6;i< One; i++) Acout<<A[i]; -cout<<Endl; - } the return 0; -}
Other code:
1#include <stdio.h>2#include <string.h>3 intMain ()4 {5 intN,i=0;6 Charphone[ A];7scanf"%d",&n);8 for(i=0; i<n;i++){9scanf"%s", phone);Tenphone[5]='6'; One for(intj=5;j< One; j + +) A Putchar (Phone[j]); -printf"\ n"); - } the return 0; -}
1#include <iostream>2 3 using namespacestd;4 5 intMain ()6 {7 intN;8Cin>>N;9 if(n<=0|| N> $)Ten return 0; One Char(*a) [ One]=New CharN [ One]; A Char(*R) [7]=New CharN [7]; - for(intI=0; i<n;++i) - { theCin>>A[i]; - for(intj=6;j< One;++j) - { -r[i][0] ='6'; +r[i][j-5] =A[i][j]; -r[i][6] =' /'; + } A at } - for(intI=0; i<n;++i) - { -cout<<r[i]<<Endl; - } - return 0; in}
Wuhan University of Science and Technology acm:1005:0 starting point algorithm 101--mobile phone cornet