/*
知识点
1.贪心算法
思路
1.
2.
用例
1:输入:
1
1 1 1
输出:
99999998
2:输入:
4 3
689 513 598 563
513 600 550
输出:
15
3:输入:
())))))))(
输出:
5
4:输入:
(()())
输出:
0
5:输入:
输出:
核心代码
1.
2.
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll c=0,word[6];
string s;
int getstring(string s)
{
if(s=="one"||s=="a"||s=="first"||s=="another")
{
word[c]=1;
c++;
return 0;
}
if(s=="two"||s=="both"||s=="second")
{
word[c]=4;
c++;
return 0;
}
if(s=="three"||s=="third")
{
word[c]=9;
c++;
return 0;
}
if(s=="four")
{
word[c]=16;
c++;
return 0;
}
if(s=="five")
{
word[c]=25;
c++;
return 0;
}
if(s=="six")
{
word[c]=36;
c++;
return 0;
}
if(s=="seven")
{
word[c]=49;
c++;
return 0;
}
if(s=="eight")
{
word[c]=64;
c++;
return 0;
}
if(s=="nine")
{
word[c]=81;
c++;
return 0;
}
if(s=="eleven")
{
word[c]=21;
c++;
return 0;
}
if(s=="twelve")
{
word[c]=44;
c++;
return 0;
}
if(s=="thirteen")
{
word[c]=69;
c++;
return 0;
}
if(s=="fourteen")
{
word[c]=96;
c++;
return 0;
}
if(s=="fifteen")
{
word[c]=25;
c++;
return 0;
}
if(s=="sixteen")
{
word[c]=56;
c++;
return 0;
}
if(s=="seventeen")
{
word[c]=89;
c++;
return 0;
}
if(s=="eighteen")
{
word[c]=24;
c++;
return 0;
}
if(s=="nineteen")
{
word[c]=61;
c++;
return 0;
}
}
int main()
{
memset(word,0,sizeof(word));
for(int i=0;i<=6;i++)
{
cin>>s;
if(s==".")
{
break;
}
getstring(s);
}
sort(word,word+6);
ll ans=0;
for(int i=0;i<6;i++)
{
ans+=word[i];
if(i==5)
{
break;
}
ans*=100;
}
cout<<ans<<endl;
return 0;
}
/*
耗时:0天0小时22分钟28秒50毫秒
测试次数:5次
提交次数:1=>0分,2=>100分
评分:100分
时间复杂度:O()
空间复杂度:O(1)
类型:
大改:1次
小改:8次
*/
P1603
只有20分但第一个数据
Black Obama is two five zero .
输出
425
我的也输出 425
但判断WA