题解:P16436 [XJTUPC 2026] 幽灵×毕业

· · 题解

突破口

这道题的突破口在于当该学生修读了至少 3 门通识类核心课和至少 3 门通识类选修课

因为他只有6个功课,所以只要判断有3门通识类核心课即可

code

部分代码

输入

for(int i=0;i<6;i++){
      cin>>a[i];
      if(a[i]){
         cnt++;
      }
}

输出

if(cnt==3){
         cout<<"Congratulations on graduation!";   
    }else cout<<"Songfes in Japan...";