#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, p, q, j = 1;
cin >> t;
while(t--)
{
cin >> n >> p >> q;
int a[n], i;
for(i=0;i<n;i++)
cin >> a[i];
int sum = 0, cnt = 0;
for(i=0;i<n;i++)
{
sum += a[i];
if(sum <= q)
{
cnt++;
if(cnt == p)
break;
}
else
break;
}
cout << "Case " << j++ << ": " << cnt << "\n";
}
return 0;
}
using namespace std;
int main()
{
int t, n, p, q, j = 1;
cin >> t;
while(t--)
{
cin >> n >> p >> q;
int a[n], i;
for(i=0;i<n;i++)
cin >> a[i];
int sum = 0, cnt = 0;
for(i=0;i<n;i++)
{
sum += a[i];
if(sum <= q)
{
cnt++;
if(cnt == p)
break;
}
else
break;
}
cout << "Case " << j++ << ": " << cnt << "\n";
}
return 0;
}
Comments
Post a Comment