fork download
  1. #include <stdio.h>
  2.  
  3. int main(int argc, const char * argv[]) {
  4. // init & input
  5. char c;
  6. int a[2];
  7. int ans;
  8. int space, temp, flag;
  9. space=0; temp=0; flag=0;
  10. printf("input number1 number2\n");
  11. while((c=getchar())!='\n') {
  12. if (c==' ') {
  13. a[space] = temp ;
  14. space++;
  15. temp = 0;
  16. flag = 0;
  17. }
  18. else {
  19. flag = 1;
  20. temp = temp * 10 + (c-48);
  21. }
  22. }
  23. if(flag)
  24. a[space] = temp;
  25. ans = a[0] + a[1];
  26. printf("%d ", ans);
  27. }
Time limit exceeded #stdin #stdout 5s 4380KB
stdin
Standard input is empty
stdout
Standard output is empty