Input |
---|
12345 |
Output |
one five |
Notes 作者 CHEN, Yue
注意N最大可达100位。
#include <iostream>#include <algorithm>#include <map>#include <vector>#include <functional>#include <string>#include <cstring>#include <queue>#include <set>#include <stack>#include <cmath>#include <cstdio>#include <sstream>#include <iomanip>using namespace std;#define IOS ios_base::sync_with_stdio(false)#define TIE std::cin.tie(0)#define MIN2(a,b) (a<b?a:b)#define MIN3(a,b) (a<b?(a<c?a:c):(b<c?b:c))#define MAX2(a,b) (a>b?a:b)#define MAX3(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))typedef long long LL;typedef unsigned long long ULL;const int INF = 0x3f3f3f3f;const double PI = 4.0*atan(1.0);const double eps = 1e-6;//system("pause");const int maxn = 105;string a;string str[10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};stack<string> st;int n, sum;int main(){ cin >> a; sum = 0; for (int i = 0; i < a.size(); i++) sum += a[i] - '0'; do{ st.push(str[sum % 10]); sum /= 10; } while (sum); bool first = true; while (st.size()){ if (first) first = false; else cout << " "; cout << st.top(); st.pop(); } cout << endl; //system("pause");}新闻热点
疑难解答