zoukankan      html  css  js  c++  java
  • 统计难题

    #include<stdio.h>
    #include<iostream>
    #include<algorithm>
    #include<string.h>
    #include<vector>
    #include<cmath>
    #include<string>
    #include<map>
    #include<queue>
    using namespace std;
    typedef long long ll;
    map<string,int> m;
    
    int main(){
    	string s;
    	char c;
    	while(1){
    		scanf("%c",&c);
    		if(c=='
    '){//判断第一次回车 
    			scanf("%c",&c);
    			s.clear();
    		}
    		if(c=='
    '){//判断第二次回车 
    			break;
    		}
    		s+=c;//累加字符串 
    		m[s]++;//统计以所有可能的前缀的总词数 
    	}
    	string x;
    	while(cin>>x){
    		cout<<m[x]<<endl;//直接输出即可 
    	}
    	return 0;
    }
    

      

  • 相关阅读:
    JSON
    event flow
    for,for each,for in,for of
    history of program language
    px fr em rem
    正则符号
    DOM、BOM
    web布局
    grid
    初学python环境安装
  • 原文地址:https://www.cnblogs.com/akpower/p/11768797.html
Copyright © 2011-2022 走看看