Tuesday, April 12, 2011

11900 - Boiled Eggs

#include<stdio.h>
#define M 31
int main()
{
    int t,n,p,q,w[M],tw,i,k;
    //freopen("in.txt","r",stdin);
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d%d%d",&n,&p,&q);
        for(k=0;k<n;k++)
            scanf("%d",&w[k]);
       
        tw=0;
        for(k=0;k<p && k<n;k++)
        {
            tw=tw+w[k];
            if(tw>q)
                break;
        }
        printf("Case %d: %d\n",i,k);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.