QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#179822 | #5674. Sum of Remainders | Yshanqian | WA | 0ms | 3656kb | C++14 | 1.3kb | 2023-09-15 10:27:35 | 2023-09-15 10:27:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define xx first
#define yy second
#define endl "\n"
#define lowbit(x) x & (-x)
#define int long long
#define ull unsigned long long
#define pb push_back
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define Ysanqian ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int N = 1e6 + 10, M = 1010, inf = 0x3f3f3f3f, mod = 18446, P = 13331;
const double eps = 1e-8;
int n;
int a[N];
bool flag;
vector<int> ans;
void solve()
{
cin >> n;
int num = a[1];
int cnt = a[1];
for (int i = 2; i <= n; i++)
{
int sum = 0;
for (auto ed : ans)
sum += i % ed;
a[i] -= sum;
if (a[i] == 0)
ans.pb(i);
if (a[i] < cnt * i)
{
int x = a[i] / i;
int y = cnt;
y -= x;
cnt -= y;
for (int j = 1; j <= y; j++)
{
ans.pb(i);
if (ans.size() == a[1])
{
flag = 1;
break;
}
}
if (flag)
break;
}
}
cout << a[1] << ' ';
for (auto ed : ans)
cout
<< ed << ' ';
}
signed main()
{
Ysanqian;
int T;
T = 1;
// cin >> T;
while (T--)
solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3656kb
input:
16 4 6 10 12 6 8 12 14 18 10 3 5 9 11 5 7
output:
0 2 4 8 16
result:
wrong answer 1st lines differ - expected: '4 2 5 5 11', found: '0 2 4 8 16 '