10 条题解

  • 0
    @ 2024-12-11 18:19:54

    #include <stdio.h>

    int main() { int sh[7];//每天在学校上课的时间 int eh[7];//每天额外上课的时间 int th[7];//每天总的上课时间 int unhappydays = 0;//记录不高兴的天数 int unhappylevel[7] = {0};//记录每天不高兴的程度 int mostunhappyday = 0;//记录最不高兴的天 int total,i,maxunhappy = 0; for(i=0;i<7;i++){ scanf("%d %d",&sh[i],&eh[i]); th[i] = sh[i] + eh[i]; if(th[i] > 8){ unhappydays++; unhappylevel[i] = th[i] - 8; if(unhappylevel[i] > maxunhappy){ maxunhappy = unhappylevel[i]; mostunhappyday = i + 1; } } } if(unhappydays == 0){ printf("0\n"); } else { printf("%d\n",mostunhappyday); } return 0; }

    信息

    ID
    44
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    4141
    已通过
    841
    上传者