LibreOJ #6212. 「美团 CodeM 决赛」melon

二次联通门 : LibreOJ #6212. 「美团 CodeM 决赛」melon

 

 

 

 

/*
    LibreOJ #6212. 「美团 CodeM 决赛」melon

    MDZZ
    这是决赛题??
*/
#include <cstdio>
#include <iostream>
#include <cmath>

const int BUF = 12312312;
char Buf[BUF], *buf = Buf;
typedef long long LL;

inline void read (LL &now)
{
    for (now = 0; !isdigit (*buf); ++ buf);
    for (; isdigit (*buf); now = now * 10 + *buf - '0', ++ buf);
}

int Main ()
{
    fread (buf, 1, BUF, stdin);
    LL T; read (T);
    for (; T; -- T)
    {
        LL N, L; read (N), read (L);
        if (N <= L) printf ("%lld", N);
        else if (N > L && (N <= (L << 1))) printf ("%lld", L);
        else printf ("%lld", (N + 1) / 2);    
        putchar ('\n');        
    }
    return 0;
}
int ZlycerQan = Main ();
int main (int argc, char *argv[]) {;}

 

posted @ 2017-08-24 20:18  ZlycerQan  阅读(381)  评论(0编辑  收藏  举报