#include <stdio.h> int main() { int a = 0; int b = 0; char c; char target = 'a'; while((c = getchar()) != EOF){ if (c == '\n') { printf("%d\n",a + b); a = 0; b = 0; target = 'a'; } else { if (c == ' ') { target = 'b'; } else if (target == 'a'){ a = a * 10 + (c - '0'); } else { b = b * 10 + (c - '0'); } } } return 0; } |
Double click to view unformatted code.