fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. ifstream in("DATA.in");
  9. string temp;
  10. unsigned long long current;
  11. unsigned long long maxint = INT_MAX;
  12. unsigned long long tong = 0;
  13. while (in >> temp)
  14. {
  15. if(temp.size() > 18)
  16. {
  17. continue;
  18. }
  19. if(temp[0] >= 'A' && temp[0] <= 'z')
  20. {
  21. continue;
  22. }
  23. if(temp[0] == '-')
  24. {
  25. continue;
  26. }
  27. if(stoull(temp) > maxint)
  28. {
  29. continue;
  30. }
  31. else
  32. {
  33. tong+=stoull(temp);
  34. }
  35. }
  36. cout << tong;
  37. }
  38.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty