2 条题解

  • 1
    @ 2025-2-6 1:12:10

    方案 11 :记录该学生不及格学科的个数 q

    #include <bits/stdc++.h>
    using namespace std;
    int a, b, c, q;
    int main() {
        cin >> a >> b >> c;
        if (a < 60) q++;
        if (b < 60) q++;
        if (c < 60) q++;
        if (q == 1) cout << 1;
        else cout << 0;
        return 0;
    }
    

    方案 22 :逐个判断

    #include <bits/stdc++.h>
    using namespace std;
    int a, b, c, q;
    int main() {
    	cin >> a >> b >> c;
        if (a < 60 && b >= 60 && c >= 60 || a >= 60 && b < 60 && c >= 60 || a >= 60 && b >= 60 && c < 60) cout << 1;
        else cout << 0;
        return 0;
    }
    

    方案 22 中的第 676 \sim 7 行代码可以改写成以下形式:

    if (a < 60 && b >= 60 && c >= 60) cout << 1;
    else if (a >= 60 && b < 60 && c >= 60) cout << 1;
    else if (a >= 60 && b >= 60 && c < 60) cout << 1;
    else cout << 0;
    

    祝大家抄的开心且被管理员封号^v^

    • 0
      @ 2024-12-12 19:07:53

      #include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c; d=60; if (a=d and c>=d) {cout<<1;} else if (a>=d and b=d) {cout<<1;} else if (a>=d and b>=d and c<d) {cout<<1;} else {cout<<0;} return 0; } //自己换行

      • 1

      信息

      ID
      4494
      时间
      1000ms
      内存
      128MiB
      难度
      1
      标签
      (无)
      递交数
      105
      已通过
      67
      上传者