QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197136 | #6135. Books | HarryJ | Compile Error | / | / | C++23 | 1.2kb | 2023-10-02 11:58:17 | 2023-10-02 11:58:17 |
Judging History
This is the latest submission verdict.
- [2023-10-02 11:58:17]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-10-02 11:58:17]
- Submitted
answer
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int inf = 1e9 + 5;
ll a[maxn];
int main()
{
int T;
ll n, m;
scanf("%d", &T);
while(T--) {
scanf("%lld%lld", &n, &m);
ll k = 0;
ll mi = inf;
int i;
for(i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
if(a[i] == 0)
k++;
if(mi > a[i])
mi = a[i];
}
if(k > m) {
printf("Impossible\n");
continue;
}
if(n == m) {
printf("Richman\n");
continue;
}
if(m == 0) {
printf("%lld\n", mi - 1);
continue;
}
ll sum = 0;
for(i = 1; i <= n; i++) {
if(k == m)//易错
break;
if(a[i] != 0) {
sum += a[i];
k++;
}
}
mi = inf;
for(; i <= n; i++) {
if(a[i] != 0)
mi = min(a[i], mi);
}
printf("%lld\n", sum + mi - 1);
}
return 0;
詳細信息
answer.code: In function ‘int main()’: answer.code:56:14: error: expected ‘}’ at end of input 56 | return 0; | ^ answer.code:10:1: note: to match this ‘{’ 10 | { | ^ answer.code:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &T); | ~~~~~^~~~~~~~~~ answer.code:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%lld%lld", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~~~~~ answer.code:20:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%lld", &a[i]); | ~~~~~^~~~~~~~~~~~~~~