3 条题解

  • 2
    @ 2025-2-15 4:59:14

    不喜欢if-else的有福了(bushi)

    #include <bits/stdc++.h>
    
    int main(){
        int a, b;
        scanf("%d", &a);
        b = !(a % 2) + (a > 4 && a <= 12);
        printf("%d %d %d %d", b == 2, !!b, b == 1, !b);
    }
    
    • 1
      @ 2025-5-17 16:38:20

      简简单单打个表

      AC代码:

      #include <bits/stdc++.h>
      using namespace std;
      inline int read(){
      	register int x = 0;
      	register bool f = 0;
      	register char c = getchar();
      	while(c < '0' || c > '9'){
      		if(c == '-') f = 1;
      		c = getchar();
      	}
      	while(c>='0'&&c<='9'){
      		x = (x << 3) + (x << 1) + c - 48;
      		c = getchar();
      	}
      	return f ? -x : x;
      }
      int a,b;
      int main(){
      	a = read();
      	if(a % 2 == 0) b++;
      	if(a > 4 && a <= 12) b++;
      	if(b == 2) cout << "1 1 0 0";
      	if(b == 1) cout << "0 1 1 0";
      	if(b == 0) cout << "0 0 0 1";
          return 0;
      }
      
      
      • 0

        #include<bits/stdc++.h> using namespace std; int main() { int x; cin>>x; if(x%20 && (x>4 && x<=12)) { cout<<1<<" "; } else { cout<<0<<" "; } if(x%20 || (x>4 && x<=12)) { cout<<1<<" "; } else { cout<<0<<" "; } if((x%2==0 && (x<=4 || x>12)) || (x%2!=0 && (x>4 && x<=12))) { cout<<1<<" "; } else { cout<<0<<" "; } if(x%2!=0 && (x<=4 || x>12)) { cout<<1<<" "; } else { cout<<0<<" "; } return 0; }

        • 1

        信息

        ID
        9732
        时间
        1000ms
        内存
        125MiB
        难度
        1
        标签
        (无)
        递交数
        124
        已通过
        58
        上传者