2012 ACM/ICPC Asia Regional Tianjin 1010 Intelligent IME

本文介绍了一种基于手机智能输入法的匹配算法实现方案。该算法通过将输入的数字序列映射到对应的英文字符,从字典中找出所有可能匹配的单词。文中提供了一个具体的编程实现案例。

                     1010. Intelligent IME
Description
We all use cell phone today. And we must be familiar with the intelligent English
input method on the cell phone. To be specific, the number buttons may correspond to
some English letters respectively, as shown below:
2 : a, b, c 3 : d, e, f 4 : g, h, i 5 : j, k, l 6 : m, n, o
7 : p, q, r, s 8 : t, u, v 9 : w, x, y, z
When we want to input the word “wing”, we press the button 9, 4, 6, 4, then the
input method will choose from an embedded dictionary, all words matching the input
number sequence, such as “wing”, “whoi”, “zhog”. Here comes our question, given a
dictionary, how many words in it match some input number sequences?
Input
First is an integer T, indicating the number of test cases. Then T block follows,
each of which is formatted like this:
Two integer N (1 <= N <= 5000), M (1 <= M <= 5000), indicating the number of
input number sequences and the number of words in the dictionary, respectively. Then
comes N lines, each line contains a number sequence, consisting of no more than 6
digits. Then comes M lines, each line contains a letter string, consisting of no more
than 6 lower letters. It is guaranteed that there are neither duplicated number
sequences nor duplicated words.
Output
For each input block, output N integers, indicating how many words in the
dictionary match the corresponding number sequence, each integer per line.
Sample Input
13
5
46
64448
74
go
in
night
might
gn
第37 届ACM-ICPC 亚洲天津赛区网络赛试题(2012 年9 月9 日)
17
Sample Output
3

2

0

 

题目大意:就是给出数字和字符串,看每一行数字能够对应几个字符串

思路:呜呜,我这菜鸟太菜了~~反过来的映射那么简单~~就没想到

program:


 #include <iostream>
 #include <cstdio>
 #include <cstring>
 #include <map>
 
 using namespace std;
 
 const int X = 5005;
 
 int n,m;
 int use[X];
 
 int a[] = {2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
 
 map<int,int> ma;
 char s[10];
 
 int main(){
     freopen("sum.in","r",stdin);
     int ncase;
     scanf("%d",&ncase);
     while(ncase--){
         int x;
         scanf("%d%d",&n,&m);
         ma.clear();
         memset(use,0,sizeof(use));
         for(int i=1;i<=n;i++){
             scanf("%d",&x);
             ma[x] = i;
         }
         int temp;
         for(int i=0;i<m;i++){
             scanf("%s",s);
             temp = 0;
             for(int j=0;s[j];j++)
                 temp = temp*10+a[s[j]-'a'];  //上面的那个数组是巧妙还原成数字较为简单
             use[ma[temp]]++;
         }
         for(int i=1;i<=n;i++)
             printf("%d\n",use[i]);
     }
     return 0;
 }

 

转载出处:http://www.cnblogs.com/yejinru/archive/2012/09/09/2677665.html

光伏储能虚拟同步发电机VSG并网仿真模型(Similink仿真实现)内容概要:本文档介绍了光伏储能虚拟同步发电机(VSG)并网仿真模型的Simulink实现方法,重点在于通过建立光伏储能系统与虚拟同步发电机相结合的仿真模型,模拟其在并网过程中的动态响应与控制特性。该模型借鉴了同步发电机的惯性和阻尼特性,提升了新能源并网系统的频率和电压支撑能力,增强了系统的稳定性与可控性。文档还提及相关电力系统仿真技术的应用,包括逆变器控制、储能配置、并网稳定性分析等,并提供了完整的Simulink仿真文件及技术支持资源链接,便于科研人员复现与二次开发。; 适合人群:电气工程、自动化、能源系统等相关专业的研究生、科研人员及从事新能源并网技术开发的工程师。; 使用场景及目标:①用于研究光伏储能系统在弱电网条件下的并网稳定性问题;②掌握虚拟同步发电机(VSG)控制策略的设计与仿真方法;③支持高水平论文(如EI/SCI)的模型复现与创新研究;④为微电网、智能电网中的分布式能源接入提供技术参考。; 阅读建议:建议结合提供的Simulink模型文件与文档说明逐步操作,重点关注VSG控制模块的参数设置与动态响应分析,同时可延伸学习文中提及的MPPT、储能管理、谐波分析等相关技术,以提升综合仿真能力。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值