QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#739611 | #9423. Gold Medal | zzisjtu | WA | 0ms | 3624kb | C++23 | 1.2kb | 2024-11-12 22:24:22 | 2024-11-12 22:24:25 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define lowbit(i) ((i)&(-i))
#define pii pair<int,int>
#define endl '\n'
#define mk(x,y) make_pair(x,y)
#define popcount(x) __builtin_popcount(x)
#define LF(x) fixed<<setprecision(x)
const double pi = 3.14159265358979323846;
const double eps = 1e-9;
const int inf = 1e9;
const long long INF = 4e18;
const int mod = 1e9+7;
using namespace std;
const int N = 1e5+10;
void solve() {
int n, k; cin >> n >> k;
vector<int>a(n +10);
for (auto& i : a)cin >> i;
auto cmp = [&](int x, int y) -> bool {
int tx = x % k, ty = y % k;
if (!tx)tx = k;
if (!ty)ty = k;
return tx >= ty;
};
sort(all(a), cmp);
int ret = 0;
int m; cin >> m;
for (int i = 0; i < n; i++) {
int t = a[i] % k;
if (t && m > k - t) {
a[i] += k - t;
m -= k - t;
}
ret += 0 + a[i] / k;
}
ret += 0 + m / k;
cout << ret << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
2 3 10 239 141 526 6 2 1 300 100 1000
output:
0 0
result:
wrong answer 1st lines differ - expected: '91', found: '0'