P1603
  • 板块灌水区
  • 楼主jiangyunuo
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/21 12:48
  • 上次更新2024/12/21 16:38:48
查看原帖
P1603
1061050
jiangyunuo楼主2024/12/21 12:48
#include<bits/stdc++.h>  
using namespace std;
int main(){
	char ch[100];
	string a[10];
    string sh[30]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","a","both","another","first","second","third"};
    string b[30]={"00","01","04","09","16","25","36","49","64","81","00","21","44","69","96","25","56","89","24","61","00","01","04","01","01","04","09"};
	int tot=0,len;
	for(int i=1;i<=6;i++){
		cin>>ch;
		len=strlen(ch);
		for(int j=0;j<len;j++)if(ch[i]<=90)ch[i]+=32;
		for(int j=0;j<=26;j++){
			if(ch==sh[j]){a[++tot]=b[j];break;}
		}
	}
	sort(a+1,a+tot+1);
	bool z=0;
	int c;
	for(int i=1;i<=tot;i++){
		c=a[i].size();
		for(int j=0;j<c;j++){
			if(a[i][j]=='0'&&z)cout<<0;
			if(a[i][j]>'0'&&a[i][j]<='9'){cout<<a[i][j];z=1;}
		}
	}
	if(z==0)cout<<0;
	cout<<endl;
    return 0;
}

求救

2024/12/21 12:48
加载中...