7 条题解

  • 0
    @ 2025-3-26 21:44:46
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    int h,m;
    string ansh,ansm,_clock="o'clock",a[]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nighteen","twenty"},thirty="thirty",forty="forty",fifty="fifty";
    int main()
    {
    	cin>>h>>m;
    	if(m==0)ansm = _clock;
    	else if(m<=20)ansm = a[m];
    	else{
    		if(m<30)ansm+=a[20],m-=20;
    		else if(m<40)ansm+=thirty,m-=30;
    		else if(m<50)ansm+=forty,m-=40;
    		else ansm+=fifty,m-=50;
    		ansm = ansm+" "+a[m];
    	}
    	if(h<=20)ansh = a[h];
    	else{
    		if(h<30)ansh+=a[20],h-=20;
    		else if(h<40)ansh+=thirty,h-=30;
    		else if(h<50)ansh+=forty,h-=40;
    		else ansh+=fifty,h-=50;
    		ansh = ansh+" "+a[h];
    	}
    	cout<<ansh<<" "<<ansm;
    	return 0;
    }
    
    

    信息

    ID
    1084
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    147
    已通过
    45
    上传者