罪犯转移

#include"stdio.h"


int main()
{
    int cri_All,cri_Tran,cri_weight,i,temp_Weight,tran_ways=0;
    int eveCriWeight[1000];


    scanf("%d %d %d", &cri_All,&cri_weight,&cri_Tran);


    for(i = 0; i     scanf("%d", &eveCriWeight[i]);


    temp_Weight=0;
    for(i=0;i     {
        if(i+1>=cri_Tran)
        {
            if(temp_Weight                 tran_ways++;


           temp_Weight-=eveCriWeight[i-cri_Tran];
        }
        temp_Weight+=eveCriWeight[i];
    }


    printf("%d",tran_ways);


    return 0;
}

你可能感兴趣的:(c语言算法练习,学习过程)