2 solutions

  • 0
    @ 2024-7-20 20:50:26

    提醒一下新手,int表达式的值可以强转bool

    #include<bits/stdc++.h>
    using namespace std;
    int b;
    int main(){
    	cin>>b;
    	if(b%2)cout<<"odd";
    	else cout<<"even";
    	return 0;
    }
    
    • 0
      @ 2024-7-15 20:41:39
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
      	int a;
      	cin>>a;
      	if(a%2==0) cout<<"even";
      	else cout<<"odd";
      	return 0;
      }
      
      • 1

      Information

      ID
      6881
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      1
      Tags
      # Submissions
      14
      Accepted
      9
      Uploaded By