[c]sdnuoj1119 Intelligent IME
来源:互联网 发布:前后端分离架构 知乎 编辑:程序博客网 时间:2024/06/09 20:08
http://210.44.14.31/solution/view/24587
题目标题 intelligent IME
题目大意 手机上的9格输入判定
这个题一开始以为字符串会很长,以为需要hash,结果最多6个字符,就比较简单了
#include<iostream>#include<stdio.h>#include<string>#include<string.h>using namespace std;int a[2000000]={0};int m1[10000];int make(string x){int re=0;int len=x.size();int b=1;int r;for(int i=len-1;i>=0;i--){char s=x[i];if(s>='a' && s<='c') r=2; else if(s>='d' && s<='f') r=3; else if(s>='g' && s<='i') r=4; else if(s>='j' && s<='l') r=5; else if(s>='m' && s<='o') r=6; else if(s>='p' && s<='s') r=7; else if(s>='t' && s<='v') r=8; else r=9; re+=b*r; b*=10;}return re;}int main(){int T;cin>>T;for(int o=0;o<T;o++){memset(a,0,sizeof(a));int m,n;string x;cin>>m>>n;for(int i=0;i<m;i++){cin>>m1[i];}for(int i=0;i<n;i++){cin>>x;a[make(x)]++;}for(int i=0;i<m;i++){cout<<a[m1[i]]<<endl;}}return 0;}
0 0
- [c]sdnuoj1119 Intelligent IME
- Intelligent IME
- Intelligent IME
- Intelligent IME
- 【STL】 hdu4287 Intelligent IME
- hdu 4287 Intelligent IME
- HDU-4287-Intelligent IME
- HDU 4287 Intelligent IME
- hdu 4278 Intelligent IME
- hdu 4287 Intelligent IME
- Intelligent IME hdu 4287
- HDU4287:Intelligent IME
- HDU 4287 Intelligent IME
- HDU4287- Intelligent IME
- HDU 4287 Intelligent IME
- hdu4287 Intelligent IME
- HDU 4287 Intelligent IME
- hdu-4287 Intelligent IME
- 通过try/catch block载入文件
- CGContextRef 与 CGPathRef
- 容己容人容事,从容一生
- lua 可变参数
- Angular 常用ng指令详解
- [c]sdnuoj1119 Intelligent IME
- AD无原理图画pcb无网络连线设置
- 第3章 线性表
- LeetCode(67) Add Binary
- 减治法
- 这一次要做到底
- 排序算法之树形选择排序
- 使用VS2010连接MySQL
- 面试准备