Emiliatan

d402

Feb 23rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. /* d402            */
  2. /* AC (2ms, 104KB) */
  3. #include <cstdio>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. char s[500];
  9. int a, b, i;
  10.  
  11. int toInt32(int &i)
  12. {
  13.     int len = strlen(s);
  14.     int r = 0;
  15.     while(i < len && (s[i] < '0' || s[i] > '9')) i++;
  16.     while(i < len && (s[i] >= '0' && s[i] <= '9')) r = (r << 1) + (r << 3) + s[i++] - '0';
  17.     return r;
  18. }
  19. int main()
  20. {
  21.     while(~scanf("%[^\n]s", s) && getchar())
  22.     {
  23.         i = 0;
  24.         if(a == 0) a = toInt32(i);
  25.         if(b == 0) b = toInt32(i);
  26.         if(a != 0 && b != 0) { printf("%d %d %lld\n", a, b, (long long)a + b); a = b = 0; }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment