hdu 1251 统计难题
2016-06-16 20:27
218 查看
字符串水题!!
#include<bits/stdc++.h> using namespace std; map<string,int>pq; int main() { string str,str1; while(getline(cin,str),str!="") { for(int i=0;i<str.size();i++) { if(pq.count(str.substr(0,i+1))==0) pq[str.substr(0,i+1)]=0; pq[str.substr(0,i+1)]++; } } int k=0; while(cin>>str1) { cout<<pq[str1]<<"\n"; } return 0; }
相关文章推荐
- 【HDU 5366】The mook jong 详解
- 【HDU 2136】Largest prime factor 详细图解
- 【HDU 1568】Fibonacci 数学公式 详解
- HDU 1568
- HDU1290
- HDU1568(Fobonacci公式)
- HDU ACM Step 2.2.2 Joseph(约瑟夫环问题)
- HDU 1405
- HDU 1297
- hdu 1205
- hdu 2087
- hdu 1016
- HDU 4898 The Revenge of the Princess’ Knight ( 2014 Multi-University Training Contest 4 )
- HDU 5592 ZYB's Premutation 线段树(查找动态区间第K大)
- HDU 5240 Exam (好水的题)
- HDU5237 Base64 大模拟
- HDU 1000
- HDU 1001
- HDU 1016 Prime Ring Problem
- HDU 1017 A Mathematical Curiosity