#include <iostream>
using namespace std;
int main(){
int t, n, num[33], p, q, j, cs = 1;
cin >> t;
while(t--){
cin >> n >> p >> q;
for(int i = 0; i < n; i++)cin >> num[i];
int sum = 0;
for(j = 0; j < n; j++){
sum += num[j];
if(sum > q)break;
}
if(j > p)cout << "Case " << cs << ": " << p << endl;
else cout << "Case " << cs << ": " << j << endl;
cs++;
}
return 0;
}
using namespace std;
int main(){
int t, n, num[33], p, q, j, cs = 1;
cin >> t;
while(t--){
cin >> n >> p >> q;
for(int i = 0; i < n; i++)cin >> num[i];
int sum = 0;
for(j = 0; j < n; j++){
sum += num[j];
if(sum > q)break;
}
if(j > p)cout << "Case " << cs << ": " << p << endl;
else cout << "Case " << cs << ": " << j << endl;
cs++;
}
return 0;
}
No comments:
Post a Comment