HDU 4287 intelligent IME [simulation]

Source: Internet
Author: User

This question is silly, because the pressed letters correspond to the unique numeric buttons.

Code:

# Include <cstdio> # include <cstring> # include <iostream> # include <cmath> # include <string> # include <vector> # include <map> # include <algorithm> using namespace STD; inline int RINT () {int X; scanf ("% d", & X); Return X;} inline int max (int x, int y) {return (x> Y )? X: Y;} inline int min (int x, int y) {return (x <Y )? X: Y ;}# define for (I, a, B) for (INT I = (a); I <= (B); I ++) # define Ford (I, a, B) for (INT I = (a); I >= (B); I --) # define rep (X) for (INT I = 0; I <(x); I ++) typedef long int64; # define Inf (1 <30) const double EPS = 1e-8; # define bug (s) cout <# S <"=" <S <"# define maxn 5002 # define maxm 5002int tonum [] = {2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9 }; char ch [maxm] [10]; char di [maxn] [10]; Map <int, int> DIC; int main () {int T = RINT (); while (t --) {dic. clear (); int n = RINT (); int M = RINT (); rep (n) {scanf ("% s", di [I]);} rep (m) {scanf ("% s", CH [I]); int ret = 0; For (int K = 0; ch [I] [k]; k ++) {ret = RET * 10 + tonum [CH [I] [k]-'a']; DIC [RET] ++ ;}} rep (N) {int ret = 0; For (int K = 0; di [I] [k]; k ++) {ret = RET * 10 + di [I] [k]-'0';} printf ("% d \ n", DIC [RET]) ;}}

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.