fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int arr[10]={0,};
  6.  
  7. for(int i=0;i<10;i++){
  8. cin>>arr[i];
  9. }
  10.  
  11. for(int i=0;i<10;i++){
  12. int total=0;
  13. for(int j=0;j<10;j++){
  14. if(j==i)
  15. continue;
  16. total+=arr[j];
  17. }
  18.  
  19. if(arr[i]==total){
  20. cout<<arr[i];
  21. break;
  22. }
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 5320KB
stdin
5
4
-5
-3
9
1
7
2
5
-11
stdout
7