This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
long long n, x;
int k, t;
void f()
{
x = n*n/2;
for(int i = n/2; i >= 1; --i)
if(n % i == 0)
x = min(x, i*i*((n/i)*(n/i)/2));
cout << x;
}
bool isprime(long long x)
{
if(x < 2) return 0;
if(x == 2 || x == 3) return 1;
if(x % 2 == 0 || x % 3 == 0) return 0;
for(int i = 5; i * i <= n; i += 6)
if(x % i == 0 || x % (i+2) == 0)
return 0;
return 1;
}
int main()
{
cin >> n >> k;
if(isprime(n)) cout << n*n/2;
else if(k == 0) f();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |