fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<iostream>
  4. using namespace std;
  5. typedef long long ll;
  6. /*float stof(const string& str, size_t *idx = 0);
  7. double stod(const string& str, size_t *idx = 0);
  8. long double stold(const string& str, size_t *idx = 0);
  9. int stoi(const string& str, size_t *idx = 0, int base = 10);
  10. long stol(const string& str, size_t *idx = 0, int base = 10);
  11. unsigned long stoul(const string& str, size_t *idx = 0, int base = 10);
  12. long long stoll(const string& str, size_t *idx = 0, int base = 10);
  13. unsigned long long stoull(const string& str, size_t *idx = 0, int base = 10); */
  14. int main()
  15. {
  16. string a,b,c;
  17. ll t;
  18. cin >>t;
  19. while(t--)
  20. {
  21. cin >>a>>b>>c;
  22. ll k,i;
  23. for(i=0;i<a.size();i++)
  24. {
  25. if(a[i]=='m')
  26. {
  27. k=0;
  28. break;
  29. }
  30.  
  31. }
  32. for(i=0;i<b.size();i++)
  33. {
  34. if(b[i]=='m')
  35. {
  36. k=1;
  37. break;
  38. }
  39.  
  40. }
  41. for(i=0;i<a.size();i++)
  42. {
  43. if(c[i]=='m')
  44. {
  45. k=2;
  46. break;
  47. }
  48.  
  49. }
  50. if(k==0)
  51. cout << stoll(c,0,10)-stoll(b,0,10)<< endl;
  52. else if(k==1)
  53. cout << stoll(c,0,10)-stoll(a,0,10)<< endl;
  54. else cout << stoll(a,0,10)+stoll(b,0,10)<< endl;
  55. }
  56. return 0;
  57. }
Runtime error #stdin #stdout #stderr 0s 3460KB
stdin
3

23 + 47 = machula

3247 + 5machula2 = 3749

machula13 + 75425 = 77038
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoll