Codeforces Round #281 (Div. 2) b

Source: Internet
Author: User

/** *  @brief  Codeforces Round  #281   (div. 2)  b *  @file   b.cpp *  @author   Face codes  *  @created  2014/12/04 18:40 *  @edited    2014/12/04 18:40 *  @type   implementation * */#include  < iostream> #include  <fstream> #include  <cstdlib> #include  <stack> #include  <vector> #include  <string> #include  <cstring> #include  <vector>using  namespace std; #define &NBSP;MAX (a, b)    ((a)  >  (b)  ?  (a)  :   (b)) #define &NBSP;MIN (A, b)    ((a)  >  (b)  ?  (b)  :  (a))   #define &NBSP;ABS (a)       ((a)  >  0  ?  (a)   :  (0 -  (a))) #define &NBSP;CLR (VEC)    memset (vec, 0, sizeof (VEC)) #define  maxn 200010struct player{    const char *name;     int points[ maxn];    long long int tot;    int cnt;} players[2] = {    {        .name =   "First"     },    {         .name =  "Second"       }}; #ifdef  debugifstream in;o fstream out; #define  CIN in#define COUT out#else#define CIN cin#define  Cout cout#endifint n, tmp;struct player * player_last;int main (void) {     ios_base::sync_with_stdio (0); #ifdef  debug    cin.open ("./in",   ios::in);     cout.open (". Out",   ios::out); #endif      cin >> n;    for (int i = 0; i < n; i++) {         cin >> tmp;        player_last   = tmp > 0 ? &players[0] : &players[1];         tmp = abs (TMP);         player_last->tot += tmp;        player_last->points[ Player_last->cnt++] = tmp;    }    struct player  *lft, *rht;    lft = &players[0];    rht  = &players[1];    if (Lft->tot < rht->tot) {         COUT << rht->name <<  "\ n";         return 0;    }else if (Lft->tot > rht->tot) {         COUT << lft->name <<  "\ n";         return 0;    }else{         ;    }        int i;     for (I = 0; i < max (lft->cnt, rht->cnt);  i++) {             if (lft->points[i] != rht- >points[i])                      break;    }    if (lft->points[i] >  rht->points[i]) {        cout << lft->name  <<&nbSP; " \ n ";        return 0;    }     if (Lft->points[i] < rht->points[i]) {         cout << rht->name <<  "\ n";         return 0;    }        cout <<  player_last->name <<  "\ n";     return 0;}


Codeforces Round #281 (Div. 2) b

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.