6 条题解

  • 3
    @ 2023-3-9 21:07:32
    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        if(n % 2 == 0) cout << "even" <<endl;
        else cout << "odd" <<endl;
        return 0;
    }
    
    • 2
      @ 2025-12-21 21:36:27
      #include<iostream>
      #include<cstdio>
      #include<cctype>
      #include<string.h>
      #include<math.h>
      #include<cmath>
      #include<algorithm>
      #include<iomanip>
      using namespace std;
      int main()
      {
      	long long a;
      	cin>>a;
      	if(a%2!=0)
      	{
      		cout<<"odd"; 
      	}
      	else
      	{
      		cout<<"even";	
      	} 
      	return 0;
      }
      
      
      
      • 2
        @ 2025-8-16 21:40:21
        n = int(input())#输入时直接将n转为int类型
        if n % 2:#非零即为真,故该语句等价于n % 2 == 1,当n % 2 != 0时即执行语句
            print('odd')
            exit(0)#直接结束程序,使程序无需再做偶数判断,更省时
        print('even')#若仍未退出程序,即未被判断为奇数则n一定为偶数,则直接输出即可,无需再做判断
        
        • 0
          @ 2026-5-31 17:43:14
          #include <iostream>
          using namespace std;
          int a;
          int main()
          {
              cin>>a;
              if(a%2==0)
                  cout<<"even";
              else
                  cout<<"odd";
              return 0;
          }
          
          
          • -1
            @ 2025-7-8 15:55:38

            #include

            using namespace std;

            int main()

            {

            int n;
            
            cin>>n;
            
            if(n%2==1)
            
            {
            
            	cout<<"odd";
            }
            else
            {
            	cout<<"even";
            }
            return 0;
            

            }

            • -2
              @ 2024-5-9 20:55:02

              #include using namespace std; int main(){ int n; cin>>n; if(n%2==0){ cout<<"even"; } else{ cout<<"odd"; } return 0; }

              • 1

              信息

              ID
              872
              时间
              1000ms
              内存
              128MiB
              难度
              2
              标签
              递交数
              208
              已通过
              126
              上传者