Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sqrt(n)*sqrt(n) https://codeforces.com/group/mE6q0CijMT/contest/412684/problem/A
- #include <bits/stdc++.h>
- #define loop(x, n) for (int i = x; i < n; i++)
- #define err cout << "ERROR" << endl;
- #define all(x) x.begin(), x.end()
- #define f first
- #define s second
- #define pii pair<int, int>
- #define pb push_back
- typedef long long ll;
- #define DEBUG 1
- using namespace std;
- #define DEBUG 1
- ll dvs(ll x){
- ll cnt = 0;
- ll d = 0;
- for(ll i = 2; i * i < x; i++ ){
- if(x%i == 0){
- cnt++;
- }
- d = i;
- }
- cnt*=2;
- d++;
- if(d*d == x){
- // cout << d << "\n";
- cnt++;
- }
- return cnt + 2;
- }
- void solve(){
- ll n;
- cin >> n;
- ll mx = 0, ans = 1;
- // cout << dvs(n);
- for(ll i = n; i*i >= n; i-- ){
- ll xuq = dvs(i);
- // cout << xuq<<"\n";
- mx = max(mx, xuq);
- if(mx == xuq){
- ans = i;
- }
- }
- cout << mx << " "<< ans;
- }
- int main() {
- #ifdef DEBUG
- freopen("text.txt", "r", stdin);
- #else
- freopen("divisors.in", "r", stdin);
- freopen("divisors.out", "w", stdout);
- #endif
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment