# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199763 | SamAnd | Popcount (COCI19_popcount) | C++17 | 5 ms | 376 KiB |
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 <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> ang2(const vector<int>& v)
{
vector<int> ans;
int m = 0;
for (int i = v.size() - 1; i >= 0; --i)
{
ans.push_back((v[i] * 2 + m) % 10);
m = (v[i] * 2 + m) / 10;
}
if (m)
ans.push_back(m);
reverse(ans.begin(), ans.end());
return ans;
}
void tp(const vector<int>& v)
{
for (int i = 0; i < v.size(); ++i)
{
cout << v[i];
}
}
void solv1()
{
vector<int> v;
v.push_back(1);
for (int i = 1; i <= k; ++i)
{
v = ang2(v);
cout << "A=((A-(A&";
tp(v);
cout << "))+((A&";
tp(v);
cout << ")>>" << i << "))\n";
}
}
int main()
{
cin >> n >> k;
if (2 <= n && n <= 100 && k == n - 1)
solv1();
return 0;
}
Compilation message (stderr)
# | 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... |