| 
1 |  | -// C++ program to build the smallest number by removing n digits from   | 
2 |  | -// a given number   | 
3 |  | -#include<iostream>   | 
4 |  | -#include<vector>   | 
5 |  | -using namespace std;   | 
6 |  | - | 
7 |  | -// A recursive function that removes 'n' characters from 'str'   | 
8 |  | -// to store the smallest possible number in 'res'   | 
9 |  | -void buildLowestNumberRec(string str, int n, string &res)   | 
10 |  | -{   | 
11 |  | -	// If there are 0 characters to remove from str,   | 
12 |  | -	// append everything to result   | 
13 |  | -	if (n == 0)   | 
14 |  | -	{   | 
15 |  | -		res.append(str);   | 
16 |  | -		return;   | 
17 |  | -	}   | 
18 |  | - | 
19 |  | -	int len = str.length();   | 
20 |  | - | 
21 |  | -	// If there are more characters to remove than string   | 
22 |  | -	// length, then append nothing to result   | 
23 |  | -	if (len <= n)   | 
24 |  | -		return;   | 
25 |  | - | 
26 |  | -	// Find the smallest character among first (n+1) characters   | 
27 |  | -	// of str.   | 
28 |  | -	int minIndex = 0;   | 
29 |  | -	for (int i = 1; i<=n ; i++)   | 
30 |  | -		if (str[i] < str[minIndex])   | 
31 |  | -			minIndex = i;   | 
32 |  | - | 
33 |  | -	// Append the smallest character to result   | 
34 |  | -	res.push_back(str[minIndex]);   | 
35 |  | - | 
36 |  | -	// substring starting from minIndex+1 to str.length() - 1.   | 
37 |  | -	string new_str = str.substr(minIndex+1, len-minIndex);   | 
38 |  | - | 
39 |  | -	// Recur for the above substring and n equals to n-minIndex   | 
40 |  | -	buildLowestNumberRec(new_str, n-minIndex, res);   | 
41 |  | -}   | 
42 |  | - | 
43 |  | -// A wrapper over buildLowestNumberRec()   | 
44 |  | -string buildLowestNumber(string str, int n)   | 
45 |  | -{   | 
46 |  | -	string res = "";   | 
47 |  | - | 
48 |  | -	// Note that result is passed by reference   | 
49 |  | -	buildLowestNumberRec(str, n, res);   | 
50 |  | - | 
51 |  | -	return res;   | 
52 |  | -}   | 
53 |  | - | 
54 |  | -// Driver program to test above function   | 
55 |  | -int main()   | 
56 |  | -{   vector<int>v; v.push_back(NULL);  | 
57 |  | -	string str = "987654321";   | 
58 |  | -	int n = 2;   | 
59 |  | -	cout << buildLowestNumber(str, n);   | 
60 |  | -	return 0;   | 
61 |  | -}   | 
 | 1 | +// // C++ program to build the smallest number by removing n digits from   | 
 | 2 | +// // a given number   | 
 | 3 | +// #include<iostream>   | 
 | 4 | +// #include<vector>   | 
 | 5 | +// using namespace std;   | 
 | 6 | + | 
 | 7 | +// // A recursive function that removes 'n' characters from 'str'   | 
 | 8 | +// // to store the smallest possible number in 'res'   | 
 | 9 | +// void buildLowestNumberRec(string str, int n, string &res)   | 
 | 10 | +// {   | 
 | 11 | +// 	// If there are 0 characters to remove from str,   | 
 | 12 | +// 	// append everything to result   | 
 | 13 | +// 	if (n == 0)   | 
 | 14 | +// 	{   | 
 | 15 | +// 		res.append(str);   | 
 | 16 | +// 		return;   | 
 | 17 | +// 	}   | 
 | 18 | + | 
 | 19 | +// 	int len = str.length();   | 
 | 20 | + | 
 | 21 | +// 	// If there are more characters to remove than string   | 
 | 22 | +// 	// length, then append nothing to result   | 
 | 23 | +// 	if (len <= n)   | 
 | 24 | +// 		return;   | 
 | 25 | + | 
 | 26 | +// 	// Find the smallest character among first (n+1) characters   | 
 | 27 | +// 	// of str.   | 
 | 28 | +// 	int minIndex = 0;   | 
 | 29 | +// 	for (int i = 1; i<=n ; i++)   | 
 | 30 | +// 		if (str[i] < str[minIndex])   | 
 | 31 | +// 			minIndex = i;   | 
 | 32 | + | 
 | 33 | +// 	// Append the smallest character to result   | 
 | 34 | +// 	res.push_back(str[minIndex]);   | 
 | 35 | + | 
 | 36 | +// 	// substring starting from minIndex+1 to str.length() - 1.   | 
 | 37 | +// 	string new_str = str.substr(minIndex+1, len-minIndex);   | 
 | 38 | + | 
 | 39 | +// 	// Recur for the above substring and n equals to n-minIndex   | 
 | 40 | +// 	buildLowestNumberRec(new_str, n-minIndex, res);   | 
 | 41 | +// }   | 
 | 42 | + | 
 | 43 | +// // A wrapper over buildLowestNumberRec()   | 
 | 44 | +// string buildLowestNumber(string str, int n)   | 
 | 45 | +// {   | 
 | 46 | +// 	string res = "";   | 
 | 47 | + | 
 | 48 | +// 	// Note that result is passed by reference   | 
 | 49 | +// 	buildLowestNumberRec(str, n, res);   | 
 | 50 | + | 
 | 51 | +// 	return res;   | 
 | 52 | +// }   | 
 | 53 | + | 
 | 54 | +// // Driver program to test above function   | 
 | 55 | +// int main()   | 
 | 56 | +// {   vector<int>v; v.push_back(NULL);  | 
 | 57 | +// 	string str = "987654321";   | 
 | 58 | +// 	int n = 2;   | 
 | 59 | +// 	cout << buildLowestNumber(str, n);   | 
 | 60 | +// 	return 0;   | 
 | 61 | +// }   | 
 | 62 | + | 
 | 63 | +/*              |\ | |  ||\ \ /(_~     |~)|_~|\/||_~|\/||~)|_~|~)  | 
 | 64 | +				|~\|_|/\||~\ | ,_)     |~\|__|  ||__|  ||_)|__|~\  | 
 | 65 | +
  | 
 | 66 | +				   \ //~\| |    |\ |~)|_~    | ||\ ||/~\| ||_~  | 
 | 67 | +					| \_/\_/    |~\|~\|__    \_/| \||\_X\_/|__  | 
 | 68 | +				(J U S T   L I K E   E V E R Y O N E   E L S E !)  | 
 | 69 | +
  | 
 | 70 | +							 __ ,..---.._  | 
 | 71 | +							+''''`--''-..`--..__  | 
 | 72 | +						   .\ _,/:i--._`:-:+._`.``-._  | 
 | 73 | +						  /`.._,,' \   `-.``--:.b....=.  | 
 | 74 | +						 |`..__,,..`.    '`.__::i--.-::_  | 
 | 75 | +						 )- .....--i'\..      --+`'''-'  | 
 | 76 | +					   ,' .'.._,.-'|._-b\  | 
 | 77 | +					  /,'<'    V   `oi| \             _.  | 
 | 78 | +					 |/ -|,--.." ,'-. ||\..      _.,;:'_<'  | 
 | 79 | +					 ''/ |  . ' |\||'\    /-'_/' `.  | 
 | 80 | +					|,','|    , .    .-.|:.`.  + .,:..  |  | 
 | 81 | +				 ._,:'/ /-\   '^'   -Y"\ |.| || /,+8d| |  | 
 | 82 | +				.|/,'| |/':: ':=:' ,'|  | | \|| "+)='  |  | 
 | 83 | +				|+,';' /|_/ \     _/ \b':.\  \'| .||   ,'  | 
 | 84 | +				,,:-i''_i' | ``-.Y',. ,|`: | \;- | |_,'  | 
 | 85 | +		  __   |'| |i:'._ ,'     ,' ,; | |-)-'  __--:b__  | 
 | 86 | +		 .P|   | |/,'|\  - ._   /  /   _,Y-   ,:/'  `.  `'".._  | 
 | 87 | +		,'|| -','' | ._i._   `':| ,..,'     ,Y;'      \       `- ._  | 
 | 88 | +	   |||||,..    | \ '-.._ _,' /       _,b-'         `.         '-.  | 
 | 89 | +	   ||||P..i,  .| '....,-' _,'''''-'''               '    _,..    `\  | 
 | 90 | +	   +'`   <'/  |`-.....---'                       ._         ,._  | 
 | 91 | +		|      |                                    ,'``,:-''''/,--`.  | 
 | 92 | +	   Y|.b_,,:  |              ||                 ,;,Y'      /     |.  | 
 | 93 | +	 ,' /'----' .'|   ..       |  |         '"   .`Y'     .,-b_....;;,.  | 
 | 94 | +	|+|,'     | | \.,  '      ,'  `:.  _     ,/__`     _=:  _,'``-  | 
 | 95 | +   / +,'      | /\_........:.'      '"----:::::'Y  .'.|   |||  | 
 | 96 | +   |' '      .'/- \                          /'|| || |   |||  | 
 | 97 | +   |||      /|     \L                        /'|| ||/ |   |||  | 
 | 98 | +   `.|    ,'/       .|                      / ,'||/o;/    |||  | 
 | 99 | +	 `..._,,         |                      |/|   '       |||  | 
 | 100 | +	   ``-'          |                      |,            |||  | 
 | 101 | +					 |          ,.          |             |||  | 
 | 102 | +  ,=--------....     |          ""          |             |||  | 
 | 103 | +,/,'.            i=..+._             ,..    '..;---:::''- | |  | 
 | 104 | +'/|           __....b `-''`---....../.,Y'''''j:.,.._      | `._  | 
 | 105 | +.'      _.Y.-'       `..       ii:,'--------' |     :-+. .| | b\  | 
 | 106 | +|     .=_,.---'''''--...:..--:'  /         _..-----..:=   | | '|\  | 
 | 107 | +|    '-''`'---                  ---'_,,,--''           `,.. |  | \.  | 
 | 108 | + \  .                      ,' _,--''        :dg:      _,/ |||   |  \  | 
 | 109 | +`::b\`                 _,-i,-'                 ,..---'    ,|:|  | _|  | 
 | 110 | +`'--.:-._      ____,,,;.,'' `--._      ''''''''           |'|' .'  '  | 
 | 111 | +	 ``'--....Y''-'              `''--..._..____._____...,' |  'o-'  | 
 | 112 | +											 `''''`'''i==_+=_=i__  | 
 | 113 | +													 ||'''- '    `.  | 
 | 114 | +													  `-.......-''  | 
 | 115 | +*/                                | 
 | 116 | +#include<bits/stdc++.h>  | 
 | 117 | +using namespace std;  | 
 | 118 | +   | 
 | 119 | +#define fastio ios_base::sync_with_stdio(0); cin.tie(0)  | 
 | 120 | +#define LL long long   | 
 | 121 | +#define mod 1000000007   | 
 | 122 | +#define FOR(i, j, k) for (auto i=j ; i<k ; i++)  | 
 | 123 | +#define ROF(i, j, k) for (auto i=j ; i>=k ; i--)   | 
 | 124 | +#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)  | 
 | 125 | +#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))  | 
 | 126 | + | 
 | 127 | +const long long INF = 1e18;  | 
 | 128 | +const long long MAX = 1e5+10;  | 
 | 129 | +int main(){  | 
 | 130 | +	fastio;  | 
 | 131 | +	int t=1;// cin>>t;  | 
 | 132 | +	while(t--){  | 
 | 133 | +		int n; cin>>n;  | 
 | 134 | +		for (int i = 1; i*i <= n; i++)  | 
 | 135 | +		{  | 
 | 136 | +			/* code */  | 
 | 137 | +			if(n%i == 0) cout<<i<<" "<<n/i<<"; ";  | 
 | 138 | +		}  | 
 | 139 | +		  | 
 | 140 | +	}  | 
 | 141 | +}  | 
0 commit comments