Codeforces Round #275 (Div. 2) A

Source: Internet
Author: User

/** *  @brief  Codeforces Round  #275   (div. 2)  a *  @file   a.cpp *  @author   Face codes  *  @created  2014/12/10 15:35 *  @edited    2014/12/10 15:35 *  @type   brute * */#include  <iostream># include <fstream> #include  <cstdlib> #include  <stack> #include  <string > #include  <cstring>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)) #ifdef  DEBUGifstream in;ofstream out; #define   Cin in#define cout out#else #define cin cin#define cout cout#endiftypedef long long int ll;ll  l, r, mid, lft, rht;ll division;int search;int main (void) {     ios_base::sync_with_stdio (0); #ifdef  debug    cin.open ("./in",   ios::in);     cout.open (". Out",   ios::out); #endif      Cin >> l >> r;    if (r - l < 2) {         COUT <<  " -1\n";         return 0;    }    for ( mid = l  + 1; mid < r; mid++)         for (lft  = l; lft < mid; lft++)              for (Rht = r; rht > mid; rht--) {                 search = 0;                 for (division = 2; division  <= 50 && division <= min (Lft, mid);  division++) {                          if (lft%division == 0 && mid%division == 0) {                                  search = 1;                                  break;                         }                 }                 if ( 1 == search) {                      continue;                }                 search =  0;                for ( Division = 2; division <= 50 && division <= min (Rht ,  mid);  division++) {                         if (rht%division == 0 && mid%division  == 0) {                                 search  = 1;                                 break;                          }                 }                 if (&NBSP;1&NBSP;==&NBSp;search) {                     continue;                 }                 search = 0;                 for (division = 2; division <= 50 &&  Division <= min (Lft, rht);  division++) {                         if (rht% division == 0 && lft%division == 0) {                                  search = 1;                                  break;                         }                 }                 if ( 1 == search) {                     COUT << lft <<   " "  << mid <<  " "  << rht <<  "\ N ";                     return 0;                }             }    COUT  <<  " -1\n";     return 0;}


Codeforces Round #275 (Div. 2) A

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.