Advertisement
Yogeesh

Untitled

Jun 29th, 2014
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. //http://www.codechef.com/LTIME13/problems/SMPAIR
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4.  
  5. int main(void)
  6. {
  7. int n, num1, num2, i, j, test, temp;
  8. unsigned long long int sum;
  9. scanf("%d", &test);
  10. while(test--)
  11. {
  12. scanf("%d", &n);
  13. scanf("%d", &num1);
  14. scanf("%d", &num2);
  15. n=n-2;
  16. while(n--)
  17. {
  18. scanf("%d", &temp);
  19. if(temp<num1)
  20. {
  21. num1=temp;
  22. continue;
  23. }
  24. if(temp<num2)
  25. {
  26. num2=temp;
  27. }
  28. }
  29. sum=num1+num2;
  30. printf("%llu\n", sum);
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement