9 条题解

  • 2
    @ 2025-11-7 19:09:44

    包AC

    #include<bits/stdc++.h>
    using namespace std;
    int n,s,ans;
    int main(){
    	while(cin >> n){
    		if(n==0) break;
    		ans=0;
    		for(int i=0; i<n; i++){
    			cin >> s;
    			ans=ans^s;
    		}
    		cout << ans << "\n"; 
    	}
    	return 0;
    } 
    
    • 0
      @ 2026-11-22 19:26:32
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int t;
      	while(cin>>t&&t){
      		int x,ans=0;
      		for(int i=1;i<=t;i++){
      			cin>>x;
      			ans^=x;
      		}
      		cout<<ans<<endl;
      	}
      	return 0;
      }
      
      
      • 0
        @ 2023-12-20 20:12:52
        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e4+10;
        const int INF=0x3f3f3f3f;
        int n,x,ans;
        int main(){
        	while(cin>>n)
        	{
        		if(n==0)break;
        		for(int i=1;i<=n;i++){
        			cin>>x;
        			ans^=x;
        		}
        		cout<<ans<<endl;
        		ans=0;
        	}
        
        	return 0;
        }
        
        • 0
          @ 2023-6-6 18:06:55

          最简便代码

          #include<iostream>
          # include <stdio.h>
          int main()
          {
              int n,i,a,s;
              while(scanf("%d",&n))
              {
                  s=0;
                  if(n==0)
                      break;
                  for(i=0; i<n; i++)
                  {
                      scanf("%d",&a);
                      s^=a;
                  }
                  printf("%d\n",s);
              }
              return 0;
          }
          
          • 0
            @ 2021-11-20 21:07:12
            /*****************************************
            备注:
            ******************************************/
            #include <queue>
            #include <math.h>
            #include <stack>
            #include <stdio.h>
            #include <iostream>
            #include <vector>
            #include <iomanip>
            #include <string.h>
            #include <algorithm>
            using namespace std;
            #define LL long long
            const int N = 1e5 + 10;
            const int INF = 0x3f3f3f3f;
            int main()
            {
            	int n ;
            	cin >> n;
            	int ans = 0;
            	for(int i = 0,x ; i < n ; i++)
            	{
            		cin >> x;
            		ans ^= x;
            	}
            	cout << ans << endl;
            	return 0;
            }
            
            • -1
              @ 2024-5-2 20:13:34
              #include<iostream>
              #include<iomanip>
              #include<cstdio>
              #include<cstring>
              #include<cmath>
              #include<algorithm>
              #include<string>
              using namespace std;
              const int N=1e5+10;
              const int Inf=0x3f3f3f3f;
              int n ,x,ans = 0;
              int main(){
              	while(cin>>n){
              		if(n==0) return 0;
              		for(int i = 0,x ; i < n ; i++){
              			cin >> x;
              			ans ^= x;
              		}
              		cout << ans << endl;
              		ans=0;
              	}
              	return 0;
              }
              
              
              • -1
                @ 2023-12-20 19:49:41
                #include<bits/stdc++.h>
                using namespace std;
                const int N=1e4+10;
                int n,x,ans;
                int main()
                {
                	while(cin>>n){
                		if(n==0) break;
                		for(int i=1;i<=n;i++){
                			cin>>x;
                			ans^=x;
                		}
                		cout<<ans;
                		ans=0;
                	}
                	return 0;
                }
                

                最简便代码

                • -3
                  @ 2022-4-23 11:43:01
                  /*****************************************
                  备注:
                  ******************************************/
                  #include <queue>
                  #include <math.h>
                  #include <stack>
                  #include <stdio.h>
                  #include <iostream>
                  #include <vector>
                  #include <iomanip>
                  #include <string.h>
                  #include <algorithm>
                  #include<bits/stdc++.h>
                  using namespace std;
                  int main()
                  {
                  	int n;
                  	while(cin >> n && n)
                  	{
                  		int ans=0;
                  		for(int i=1,x;i<=n;i++)
                  		{
                  		cin >> x;
                  		ans^=x;
                  		}
                  		cout << ans<<endl;
                  	}
                  	return 0;
                  }
                  ```
                  • -5
                    @ 2022-1-8 18:56:24
                    /*****************************************
                    备注:
                    ******************************************/
                    #include <queue>
                    #include <math.h>
                    #include <stack>
                    #include <stdio.h>
                    #include <iostream>
                    #include <vector>
                    #include <iomanip>
                    #include <string.h>
                    #include <algorithm>
                    using namespace std;
                    #define LL long long
                    const int N = 1e5 + 10;
                    const int INF = 0x3f3f3f3f;
                    int main()
                    {
                    	int n ;
                    	cin >> n;
                    	int ans = 0;
                    	for(int i = 0,x ; i < n ; i++)
                    	{
                    		cin >> x;
                    		ans ^= x;
                    	}
                    	cout << ans << endl;
                    	return 0;
                    }
                    
                    • 1

                    信息

                    ID
                    1222
                    时间
                    1000ms
                    内存
                    32MiB
                    难度
                    5
                    标签
                    递交数
                    707
                    已通过
                    269
                    上传者