POJ 3096 -- Surprising Strings

 POJ 3096 -- Surprising Strings

 

 1 #include<iostream>
 2 #include<map>
 3 #include<cstring>
 4 #include<string> 
 5 using namespace std;
 6 char str[80];
 7 bool solve()
 8 {
 9     for(int i=0;i<strlen(str)-2;i++)//D的长度 
10     {
11         map<string,int> flag;
12         for(int j=0;j<strlen(str)-i-1;j++)
13         {
14             string ss = "AA";
15             ss[0] = str[j];ss[1] = str[j+i+1];ss[2] = '\0';
16             if(!flag[ss])//没有重复
17             {
18                 flag[ss] = 1;
19              } else{//重复 
20                  return false; 
21              }
22         }
23         flag.clear();
24     }
25     return true;
26 }
27 
28 int main()
29 {
30     
31     while(true)
32     {
33         cin>>str;
34         if(str[0] == '*') break;
35         if(strlen(str) <= 2)
36         {
37             cout<<str<<" is surprising."<<endl;
38         }else{
39             if(!solve()) cout<<str<<" is NOT surprising."<<endl;
40             else cout<<str<<" is surprising."<<endl;
41         }
42         
43     }
44     return 0;
45 }

 

Error 42 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string' d:\program files_x86\microsoft visual studio 9.0\vc\include\functional 143 Test
 
在使用STL的容器(比如map)的insert方法时若出现上述错误,并且其他地方没有语法错误的话,多半是没有导入头文件#include <string>

转载于:https://www.cnblogs.com/yxh-amysear/p/8594245.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值