Nanashi_Mumei @ 2024-11-05 19:32:42
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main()
{
vector<string> legal_num = {" ","one","two","three","four","five","six","seven","eight","nine",
"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
bool flag = 0;
string a;
vector<int> num;
for(int i = 0;i<6;i++)
{
cin>>a;
if(a=="a"||a=="first"||a=="another")
{
num.push_back(1);
flag = 1;
}else if(a=="both"||a=="second")
{
num.push_back(4);
flag = 1;
}else if(a=="third")
{
num.push_back(9);
flag = 1;
}
for(int j = 1;j<legal_num.size();j++)
{
if(a==legal_num[j])
{
num.push_back((j*j)%100);
flag = 1;
}
}
}
if(flag){
sort(num.begin(),num.end());
int zeroCount = 0;
while(num[zeroCount]==0)
{
zeroCount++;
}
if(num[zeroCount]/10==0)
{
cout<<num[zeroCount];
for(int i = zeroCount+1;i<num.size();i++)
{
cout<<setfill('0')<<setw(2)<<num[i];
}
}else{
for(int i = zeroCount;i<num.size();i++)
{
cout<<setfill('0')<<setw(2)<<num[i];
}
}
}else{
cout<<"0";
}
}
在ide里可以编译啊 怎么在洛谷不行
by ny_Dacong @ 2024-11-05 19:41:40
@Nanashi_Mumei sort
函数包含在头文件 <algorithm>
中。你没有调用。
by ny_Dacong @ 2024-11-05 19:42:23
@Nanashi_Mumei 我很好奇你的 ide 是怎样通过编译的。
by Nanashi_Mumei @ 2024-11-05 20:24:35
@ny_Dacong 谢谢谢谢
by Nanashi_Mumei @ 2024-11-05 20:25:12
@ny_Dacong 我也不知道qwq
by wzj1105 @ 2024-11-07 20:18:27
@ny_Dacong 一个令人深思的问题
by _xjx_ @ 2024-12-14 19:06:33
@ny_Dacong@ny_Dacong@Nanashi_Mumei@Nanashi_Mumei是不是用的VsCode?
by ny_Dacong @ 2024-12-14 19:34:46
@xjx 用不用有什么区别吗?C++ 标准通用的啊
by _xjx_ @ 2024-12-15 15:06:58
@ny_DacongVs一个头文件(iostream)就相当于bits/stdc++.h,你说有没有区别?
by ny_Dacong @ 2024-12-15 16:58:51
@xjx 没用过。神
by Nanashi_Mumei @ 2024-12-16 16:16:40
@xjx 是的是的