Submission #498767

#TimeUsernameProblemLanguageResultExecution timeMemory
498767sireanu_vladChessboard (IZhO18_chessboard)C++14
8 / 100
1 ms204 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...