63 条题解

  • 0
    @ 2023-10-15 17:52:31

    #include <iostream> using namespace std; int main() { int m,n; cin >> m; for(int i = 1; i <= m/2;i++) { cin >> n; while (n%2!=1) { cout << " " << n; } if (n%2==0) { cout << endl <<" " << n; } }

    return 0;
    

    }

    • 0
      @ 2023-10-5 16:07:16
      #include <iostream>
      using namespace std;
      int main()
      {
          int a,s[31];
          cin>>a;
          for (int i=0;i<a;i++)
          {
              cin>>s[i];
          }
          for (int i=0;i<a;i++)
          {
              if (s[i]%2==1)
              {
                  cout <<s[i]<<" ";
              }
          }
          cout <<endl;
          for (int i=0;i<a;i++)
          {
              if (s[i]%2==0)
              {
                  cout <<s[i]<<" ";
              }
          }
          return 0;
      }
      
      • 0
        @ 2023-9-3 17:01:06
        #include <iostream>
        using namespace std;
        int main()
        {
            int n,a[30],even[30],odd[30];
            cin >> n;
            for (int i = 0;i<n;i++)
            {
                cin >> a[i];
            }
            int ei = 0,oi = 0;
            for(int i = 0;i<n;i++)
            {
                if(a[i]%2 ==0)
                {
                    even[ei] = a[i];
                    ei ++;
                }
                else
                {
                    odd[oi] = a[i];
                    oi ++;
                }
            }
            for (int i = 0;i<oi;i++)
            {
                cout << odd[i] << " ";
            }
            cout << endl;
            for (int i = 0;i<ei;i++)
            {
                cout << even[i] << " ";
            }
            return 0;
        }
        
        • 0
          @ 2023-8-28 11:13:47
          #include <iostream>
          using namespace std;
          int main()
          {
          int n, a[250];//嘿嘿,瓦就要写250
              cin >> n;
              for (int i = 0; i < n; i++)
              {
                  cin >> a[i];
              }
              for (int i = 0; i < n; i++)
              {
                  if (a[i] % 2 == 1)
                  {
                      cout << a[i] << " ";
                  }
              }
              cout << endl;
              for (int i = 0; i < n; i++)
              {
                  if (a[i] % 2 == 0)
                  {
                      cout << a[i] << " ";
                  }
              }
          
              return 0;
          }
          
          • 0
            @ 2023-8-26 20:16:09
            #include <iostream>
            using namespace std;
            int main()
            {
                int n, a[100];
                cin >> n;
                for (int i = 1; i <= n; i++)
                {
                    cin >> a[i];
                }
                for (int i = 1; i <= n; i++)
                {
                    if (a[i] % 2 == 1)
                    {
                        cout << a[i] << " ";
                    }
                }
                cout << endl;
                for (int i = 1; i <= n; i++)
                {
                    if (a[i] % 2 == 0)
                    {
                        cout << a[i] << " ";
                    }
                }
                return 0;
            }
            

            😄 👍

            • 0
              @ 2023-8-22 9:42:36
              #include <iostream>
              using namespace std;
              int main()
              {
                  int n,a[30];
                  cin>>n;
                  for (int i=0;i<n;i++)
                  {
                      cin>>a[i];//输入
                      if (a[i]%2==1)//判断奇数
                      {
                          cout<<a[i]<<" ";//输出奇数
                      }
                  }
                  cout<<endl;//换行
                  for (int i=0;i<n;i++)
                  {
                      if (a[i]%2==0)//判断偶数
                      {
                          cout<<a[i]<<" ";//输出偶数
                      }
                  }
                  return 0;
              }
              

              编程不易😕 ,赞在哪里👀️ ?

              • @ 2024-1-31 21:28:08

                👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍

            • 0
              @ 2023-8-21 18:23:13

              image

              • 0
                @ 2023-8-19 11:17:13
                #include <iostream>
                using namespace std;
                int main()
                {
                    int a,b;
                    cin>>a;
                    int c[a],d = 0;
                    for (int i = 0;i<a;i++)
                    {
                        cin>>b;
                        if(b%2==1)
                        {
                            cout<<b<<" ";
                        }
                        else
                        {
                            c[d]=b;
                            d++;
                        }
                    }
                    cout<<endl;
                    for (int i = 0;i<d;i++)
                    {
                        cout<<c[i]<<" ";
                    }
                }
                
                • 0
                  @ 2023-8-17 16:23:46
                  #include<iostream>
                  using namespace std;
                  int main(){
                      int n,a[35];
                      cin>>n;
                      for(int i=1;i<=n;i++){
                          cin>>a[i];
                      }
                      for(int i=1;i<=n;i++){
                          if(a[i]%2==1){
                              cout<<a[i]<<" ";
                          }
                      }
                      cout<<endl;
                      for(int i=1;i<=n;i++){
                          if(a[i]%2==0){
                              cout<<a[i]<<" ";
                          }
                      }
                      return 0;
                  }
                  
                  • 0
                    @ 2023-8-17 15:06:52
                    #include <bits/stdc++.h>
                    using namespace std;
                    int main()
                    {
                        int n, a[100], odd[100], even[100];
                        cin >> n; 
                        for (int i=1;i<=n;i++)
                            cin >> a[i];
                        for (int i=1;i<=n;i++)
                            if (a[i] % 2 == 1) cout << a[i] << " ";
                        cout << endl;
                        for (int i=1;i<=n;i++)
                            if (a[i] % 2 == 0) cout << a[i] << " ";
                        return 0;
                    }
                    //编写不易啊,先点赞再溜可以吗!😕
                    
                    • 0
                      @ 2023-8-17 11:12:17
                      #include<bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                          int n;
                          cin>>n;
                          int a[30];
                          for(int i=0;i<n;i++)
                          {
                              cin>>a[i];
                          }
                          for(int i=0;i<n;i++)
                          {
                              if(a[i]%2==1)
                              {
                                  cout<<a[i]<<" ";
                              }
                          }
                          cout<<endl;
                          for(int i=0;i<n;i++)
                          {
                              if(a[i]%2==0)
                              {
                                  cout<<a[i]<<" ";
                              }
                          }
                          return 0;
                      }
                      
                      • 0
                        @ 2023-8-14 22:16:41
                        #include <iostream>
                        using namespace std;
                        int main()
                        {
                            int n,a[30];
                            cin >> n;
                            for (int i = 0;i < n;i++)
                            {
                                cin >> a[i];//输入每个数
                            }
                            for (int i = 0;i < n;i++)
                            {
                                if (a[i] % 2 == 1)//判断是否是奇数
                                {
                                    cout << a[i] << " ";//输出奇数
                                }
                            }
                        
                        cout << endl;//换行
                        for (int i = 0;i < n;i++)
                        {
                            if (a[i] % 2 == 0)//判断是否是偶数
                            {
                                cout << a[i] << " ";//输出偶数
                            }
                        }//不要忘了输出时加空格
                        return 0;
                        

                        }

                        
                        
                        • 0
                          @ 2023-8-14 22:12:58

                          话不多说上代码!!!!

                          • 0
                            @ 2023-8-14 20:37:27
                            #include <iostream>
                            using namespace std;
                            int main()
                            {
                                int n,a[30];
                                cin >> n;
                                for (int i = 0;i < n;i++)
                                {
                                    cin >> a[i];
                                }
                                for (int i = 0;i < n;i++)
                                {
                                    if (a[i] % 2 == 1)
                                    {
                                        cout << a[i] << " ";
                                    }
                                }
                                cout << endl;
                                for (int i = 0;i < n;i++)
                                {
                                    if (a[i] % 2 == 0)
                                    {
                                        cout << a[i] << " ";
                                    }
                                }
                                return 0;
                            }
                            
                            
                            • 0
                              @ 2023-8-10 21:54:10
                              #include <iostream>
                              using namespace std;
                              int main()
                              {
                                  int n,a[30];
                                  cin >> n;
                                  for (int i = 0;i < n;i++)
                                  {
                                      cin >> a[i];
                                  }
                                  for (int i = 0;i < n;i++)
                                  {
                                      if (a[i] % 2 == 1)
                                      {
                                          cout << a[i] << " ";
                                      }
                                  }
                                  cout << endl;
                                  for (int i = 0;i < n;i++)
                                  {
                                      if (a[i] % 2 == 0)
                                      {
                                          cout << a[i] << " ";
                                      }
                                  }
                                  return 0;
                              }
                              
                            • 0
                              @ 2023-8-8 9:46:40
                              #include <iostream>
                              using namespace std;
                              int main()
                              {
                                  int n,a[30];
                                  cin >> n;
                                  for (int i = 0;i < n;i++)
                                  {
                                      cin >> a[i];//输入每个数
                                  }
                                  for (int i = 0;i < n;i++)
                                  {
                                      if (a[i] % 2 == 1)//判断是否是奇数
                                      {
                                          cout << a[i] << " ";//输出奇数
                                      }
                                  }
                                  cout << endl;//换行
                                  for (int i = 0;i < n;i++)
                                  {
                                      if (a[i] % 2 == 0)//判断是否是偶数
                                      {
                                          cout << a[i] << " ";//输出偶数
                                      }
                                  }//不要忘了输出时加空格
                                  return 0;
                              }
                              
                              
                              • 0
                                @ 2023-8-7 9:40:10
                                #include <iostream>
                                using namespace std;
                                int main()
                                {
                                    int n,a[30];
                                    cin >> n;
                                    for (int i = 0; i < n; i++)
                                    {
                                        cin >> a[i];
                                    }
                                    for (int i = 0; i < n; i++)
                                    {
                                        if (a[i] % 2 == 1)
                                        {
                                            cout << a[i] << " ";
                                        }
                                    }
                                    cout << endl;
                                    for (int i = 0; i < n; i++)
                                    {
                                        if (a[i] % 2 == 0)
                                        {
                                            cout << a[i] << " ";
                                        }
                                    }
                                    return 0;
                                }
                                
                                • 0
                                  @ 2023-8-5 19:57:10

                                  in lgj iskf jsd; jsdf

                                  ds ]dsf

                                  dsf dsf

                                  ds

                                  d f sd

                                  • 0
                                    @ 2023-8-5 11:34:28

                                    题解

                                    接下来的事情很重要

                                    一定要认真看

                                    输出奇数的时候要加空格

                                    中间要换行
                                    输出偶数时也要加空格

                                    千万别忘记

                                    #include <iostream>
                                    using namespace std;
                                    int main()
                                    {
                                        int a[30], n;
                                        cin >> n;//输入数的个数
                                        for (int i = 0; i < n; i++)
                                        {
                                            cin >> a[i];//依次输入这些数
                                        }
                                        for (int i = 0; i < n; i++)
                                        {
                                            if (a[i] % 2 == 1)//判断是否为奇数
                                            {
                                                cout << a[i] << " ";//输出奇数,空格一定要加上
                                            }
                                        }
                                        cout << endl;//千万不要漏掉换行
                                        for (int i = 0; i < n; i++)
                                        {
                                            if (a[i] % 2 == 0)//判断是否为偶数
                                            {
                                                cout << a[i] << " ";//输出偶数,也要注意加空格
                                            }
                                        }
                                        return 0;
                                    }
                                    

                                    我这不是废话真的很重要

                                    • 0
                                      @ 2023-8-2 19:36:11

                                      新手在此🎉️ 思路:遍历数组,奇数偶数运算

                                      #include<iostream>
                                      using namespace std;
                                      int main()
                                      {
                                          int n , a[30];
                                          cin >> n;
                                          for (int i = 0;i < n;i++)
                                          {
                                              cin >> a[i];
                                              if (a[i] % 2 != 0)//第一次判断我放在循环里面了,循环里直接输出奇数
                                              {
                                                  cout << a[i] << " ";
                                              }
                                          }
                                          cout << endl;//换行不要忘记
                                          for (int i = 0;i < n;i++)//遍历数组输出偶数
                                          {
                                              if (a[i] % 2 == 0)
                                              {
                                                  cout << a[i] << " ";
                                              }
                                          }
                                          return 0;
                                      }
                                      

                                      不对请纠错

                                      看完点个赞再走呀❤️

                                      • @ 2023-8-13 18:52:05

                                        lv7=新手??????????????

                                    信息

                                    ID
                                    158
                                    时间
                                    1000ms
                                    内存
                                    256MiB
                                    难度
                                    5
                                    标签
                                    递交数
                                    7772
                                    已通过
                                    2952
                                    上传者