zoukankan      html  css  js  c++  java
  • ZOJ1171

    错误代码先放这
    #include<cstdio>
    #include<cstdlib>
    #include<iostream>
    #include<cstring>
    #include<map>
    #include<algorithm>
    using namespace std;
    map<char,string>Map;
    string s;
    char C[10000000];
    int num[100];
    void _solve(string v)
    {
    	string t=v;
    	sort(t.begin(),t.end());
    	num[t[0]-'0']++;
    	Map[t[0]]=v;
    	for(int i=1;i<t.length();i++)
    	 if(t[i]!=t[i-1])
    	  { 
    		num[t[i]-'0']++;
    	    Map[t[i]]=v;
    	  }
    }
    int main()
    {
    	int T,n,TT;
        cin>>T;
    	while(T--){
    		memset(num,0,sizeof(num));
    		scanf("%d",&n);
    		for(int i=1;i<=n;i++)
    		 {
    			 cin>>s;
    			 _solve(s);
    		 }
    		 char c=getchar();
    		 int len=0;
    		 c=getchar();
    		 bool ok=true;
    		 while(true){
    			 if(c=='#') break;
    			 if(islower(c)) toupper(c);
    			 C[++len]=c;
    			 if(isupper(c))
    			  if(num[c-'0']!=1) 
    			     ok=false;
    			 c=getchar();
    		 }
    		 if(!ok) printf("AMBIGUITY
    ");
    		 else {
    		  for(int i=1;i<=len;i++) 
    		    if(isupper(C[i]))
    		     cout<<Map[C[i]];
    		    else putchar(C[i]);
    		    cout<<endl;
    		}
    		if(T)cout<<endl;
    	}
    	return 0;
    }

  • 相关阅读:
    CSS发布时间
    1CSS简介
    CSS 样式的优先级(重要,一定要理解)
    css为什么叫层叠样式表
    Django学习手册
    Django学习手册
    Django学习手册
    Django学习手册
    Django学习手册
    Django学习手册
  • 原文地址:https://www.cnblogs.com/hua-dong/p/7603953.html
Copyright © 2011-2022 走看看