fork download
  1. #include<stdio.h>
  2.  
  3. int main() {
  4. int line1[8], line2[8], line3[8];
  5. int countLine1 = 0, countLine2 = 0, countLine3 = 0;
  6. int countLine = 0;
  7. int sum = 0;
  8.  
  9. for(int i = 0; i < 3; i++) {
  10. char c;
  11. int j = 0;
  12. while((c = getchar()) != '\n') {
  13. if(isdigit(c)) {
  14. ungetc(c, stdin);
  15. if(countLine == 0) {
  16. scanf("%d", &line1[j++]);
  17. countLine1++;
  18. } else if(countLine == 1) {
  19. scanf("%d", &line2[j++]);
  20. countLine2++;
  21. } else if(countLine == 2) {
  22. scanf("%d", &line3[j++]);
  23. countLine3++;
  24. }
  25. }
  26. }
  27. countLine++;
  28. j = 0;
  29. }
  30.  
  31. int j = 1;
  32. for(int i = countLine1 - 1; i >= 0; i--) {
  33. sum += j * line1[i];
  34. j *= 10;
  35. }
  36. j = 1;
  37. for(int i = countLine2 - 1; i >= 0; i--) {
  38. sum += j * line2[i];
  39. j *= 10;
  40. }
  41. j = 1;
  42. for(int i = countLine3 - 1; i >= 0; i--) {
  43. sum += j * line3[i];
  44. j *= 10;
  45. }
  46. printf("%d", sum);
  47.  
  48. return 0;
  49. }
  50.  
Time limit exceeded #stdin #stdout 5s 9424KB
stdin
Standard input is empty
stdout
Standard output is empty