fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7. int N,jum=0;
  8. cin >> N;
  9.  
  10. vector<int> data;
  11. for (int i=0;i<N;i++){
  12. int x;
  13. cin >>x;
  14. data.push_back(x);
  15.  
  16. jum+=x; //jum = jum + x;
  17. }
  18.  
  19. for (int i=0;i<N;i++){
  20. cout << jum-data[i] <<endl;
  21. }
  22. }
Success #stdin #stdout 0.01s 5276KB
stdin
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

int main() {
    int N,jum=0;
    cin >> N;
    
    vector<int> data;
    for (int i=0;i<N;i++){
        int x;
        cin >>x;
        data.push_back(x);
        
        jum+=x; //jum = jum + x;
    }
    
    for (int i=0;i<N;i++){
        cout << jum-data[i] <<endl;
    }
}
stdout
Standard output is empty