Time Limit: 1 Sec Memory Limit: 256 MBios
Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.git
His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.ide
He ate coffee mix without water again, so right now he's really messed up and can't think.this
Your task is to help him by telling him what to type.spa
題意code
給你100如下數字,輸出英文題解:
blog
代碼:three
//qscqesze #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; //freopen("D.in","r",stdin); //freopen("D.out","w",stdout); #define sspeed ios_base::sync_with_stdio(0);cin.tie(0) #define maxn 200001 #define mod 10007 #define eps 1e-9 //const int inf=0x7fffffff; //無限大 const int inf=0x3f3f3f3f; /* int buf[10]; inline void write(int i) { int p = 0;if(i == 0) p++; else while(i) {buf[p++] = i % 10;i /= 10;} for(int j = p-1; j >=0; j--) putchar('0' + buf[j]); printf("\n"); } */ //************************************************************************************** inline ll read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } map<int,string> s; int main() { int n=read(); s[1]="one"; s[2]="two"; s[3]="three"; s[4]="four"; s[5]="five"; s[6]="six"; s[7]="seven"; s[8]="eight"; s[9]="nine"; s[10]="ten"; s[11]="eleven"; s[12]="twelve"; s[13]="thirteen"; s[14]="fourteen"; s[15]="fifteen"; s[16]="sixteen"; s[17]="seventeen"; s[18]="eighteen"; s[19]="nineteen"; s[20]="twenty"; s[30]="thirty"; s[40]="forty"; s[50]="fifty"; s[60]="sixty"; s[70]="seventy"; s[80]="eighty"; s[90]="ninety"; if(n==0) cout<<"zero"<<endl; else if(n<=20) cout<<s[n]<<endl; else if(n%10==0) cout<<s[n]<<endl; else cout<<s[n-n%10]<<"-"<<s[n%10]<<endl; }