Submission #1122503

#TimeUsernameProblemLanguageResultExecution timeMemory
1122503kirakosyanChessboard (IZhO18_chessboard)C++20
0 / 100
0 ms328 KiB
#include<algorithm> #include<iostream> #include<vector> #include<string> #include<random> #include<cmath> #include<stack> #include<map> #include <iomanip> #include <queue> #include <set> using namespace std; using ll = long long; using ull = unsigned long long; ll mod = 1e9 + 7; ll pv(ll a, ll b) { if (b == 0)return 1; ll res = (pv(a, b / 2)); if (b % 2) { return (((res * res) % mod) * (a % mod)) % mod; } else { return (res * res) % mod; } } ll gcd(ll n1, ll n2) { if (n2 != 0) return gcd(n2, n1 % n2); else return n1; } void solve() { ll n, k; cin >> n >> k; if (n % 2 == 0) { cout << (n / 2) * n << endl;; } else { ll cnt = (n + 1) / 2; cout << cnt * (n / 2) + (n - cnt) * cnt << endl; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin.tie(nullptr); ll _ = 1; //cin >> _; while (_--) { solve(); } }
#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...