SHARE
TWEET

Untitled

Yogeesh Jun 29th, 2014 223 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top