5 条题解

  • 1
    @ 2023-3-19 9:48:30

    #include<bits/stdc++.h> using namespace std; int a[323]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int j=1;j<=n;j++) if(a[j]%2!=0) cout<<a[j]<<" "; cout<<endl; for(int j=1;j<=n;j++) if(a[j]%2==0) cout<<a[j]<<" "; return 0; }

    • 0
      @ 2022-11-6 9:38:38
      #include<bits/stdc++.h>
      using namespace std;
      int f[323];
      int main(){
      	int n;
      	cin>>n;
      	for(int i=1;i<=n;i++)
      		cin>>f[i];
      	for(int j=1;j<=n;j++)
      		if(f[j]%2!=0) cout<<f[j]<<" ";
      	cout<<endl;
      	for(int j=1;j<=n;j++)
      		if(f[j]%2==0) cout<<f[j]<<" ";
      	return 0;
      }
      
      • 0
        @ 2022-11-5 12:47:54
        #include<bits/stdc++.h>
        using namespace std;
        int f[323];
        int main(){
        	int n;
        	cin>>n;
        	for(int i=1;i<=n;i++)
        		cin>>f[i];
        	for(int j=1;j<=n;j++)
        		if(f[j]%2!=0) cout<<f[j]<<" ";
        	cout<<endl;
        	for(int j=1;j<=n;j++)
        		if(f[j]%2==0) cout<<f[j]<<" ";
        	return 0;
        }
        
        • -1
          @ 2022-11-5 12:43:55

          #include<bits/stdc++.h> using namespace std; int a[31]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++) if(a[i]%2!=0) cout<<a[i]<<" "; cout<<endl; for(int i=1;i<=n;i++) if(a[i]%2==0) cout<<a[i]<<" "; return 0;}

        • -1
          @ 2022-10-29 16:10:52

          #include<bits/stdc++.h>

          using namespace std;

          int a[35];

          int main(){

          int n;

          cin>>n;

          for(int i=1;i<=n;i++){

          cin>>a[i];

          if(a[i]%2!=0){

          cout<<a[i]<<" ";

          }

          }

          cout<<endl;

          for(int i=1;i<=n;i++){

          if(a[i]%2==0){

          cout<<a[i]<<" ";

          }

          }

          return 0;

          }

          • 1

          信息

          ID
          158
          时间
          1000ms
          内存
          64MiB
          难度
          1
          标签
          递交数
          71
          已通过
          48
          上传者