总想玩点花的,最后发现自己不是那块料,老老实实遍历。。。。
int people,price,group,add; scanf("%d %d %d %d",&people,&price,&group,&add); int fee=0; for(int i=1;i<=people;i++){ fee+=price; if(group!=0&&i%group==0)price+=add; } printf("%d",fee);