6
6
1234-the given number
7
7
OUTPUT-
8
8
One thousand Two hundred and twenty four */
9
-
10
- #include < bits/stdc++.h>
11
- #define ff first
12
- #define ss second
13
- #define int long long
14
- #define pb push_back
15
- #define mp make_pair
16
- #define pii pair<int ,int >
17
- #define vi vector<int >
18
- #define mii map<int ,int >
19
- #define pqb priority_queue<int >
20
- #define pqs priority_queue<int ,vi,greater<int > >
21
- #define setbits (x ) __builtin_popcountll(x)
22
- #define zrobits (x ) __builtin_ctzll(x)
23
- #define mod 1000000007
24
- #define inf LONG_LONG_MAX
25
- #define ps (x,y ) fixed<<setprecision(y)<<x
26
- #define endl ' \n '
27
- #define mk (arr,n,type ) type *arr=new type[n]
28
- #define w (x ) int x; cin >> x; while (x--)
29
- #define f (i,x,y ) for (int i = x; i < y; i++)
30
- #define g (i,x,y ) for (int i = x;i<=y;i++)
31
-
32
-
33
-
9
+ #include < bits/stdc++.h>
34
10
using namespace std ;
35
11
string one[] = { " " , " one " , " two " , " three " , " four " ,
36
12
" five " , " six " , " seven " , " eight " ,
@@ -44,14 +20,6 @@ string one[] = { "", "one ", "two ", "three ", "four ",
44
20
string ten[] = { " " , " " , " twenty " , " thirty " , " forty " ,
45
21
" fifty " , " sixty " , " seventy " , " eighty " ,
46
22
" ninety " };
47
-
48
-
49
-
50
- void c_p_p ()
51
- {
52
- ios_base::sync_with_stdio (0 ); cin.tie (0 ); cout.tie (0 );
53
-
54
- }
55
23
/* ******* Your Functions Below ******** */
56
24
57
25
@@ -101,35 +69,23 @@ string convertToWords(long n)
101
69
102
70
return out;
103
71
}
104
-
105
- /* ******* Your Functions Above ******** */
106
-
107
- int32_t main ()
72
+ int main ()
108
73
{
109
- c_p_p ();
110
- #ifndef ONLINE_JUDGE
111
- // For getting input from input.txt file
112
- // For getting input from input.txt file
113
- freopen (" inpute.exe" , " r" , stdin);
114
-
115
- // Printing the Output to output.txt file
116
- freopen (" output.exe" , " w" , stdout);
117
- #endif
118
74
int t;
119
75
cin>>t;
120
-
76
+
121
77
while (t--)
122
78
{
123
79
long n ;
124
80
cin>>n;
125
81
126
82
// convert given number in words
127
83
cout << convertToWords (n) << endl;
128
-
84
+
129
85
130
86
}
131
- return 0 ;
132
87
}
88
+
133
89
/* Time complexity:
134
90
Time complexity: O(1).
135
91
The loop runs for a constant amount of time.
0 commit comments