CodeForces1214B

CodeForces1214B
注意一下男生女生的人数都是有上下界的就行了,水题.

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#define MEM(x,y) memset ( x , y , sizeof ( x ) )
#define rep(i,a,b) for (int i = a ; i <= b ; ++ i)
#define per(i,a,b) for (int i = a ; i >= b ; -- i)
#define pii pair < int , int >
#define X first
#define Y second
#define rint read<int>
#define int long long
#define pb push_back

using std::set ;
using std::pair ;
using std::max ;
using std::min ;
using std::priority_queue ;
using std::vector ;
using std::swap ;
using std::sort ;
using std::unique ;
using std::greater ;

template < class T >
    inline T read () {
        T x = 0 , f = 1 ; char ch = getchar () ;
        while ( ch < '0' || ch > '9' ) {
            if ( ch == '-' ) f = - 1 ;
            ch = getchar () ;
        }
       while ( ch >= '0' && ch <= '9' ) {
            x = ( x << 3 ) + ( x << 1 ) + ( ch - 48 ) ;
            ch = getchar () ;
       }
   return f * x ;
}

template < class T >
    inline void write (T x) {
       static T stk[100] , top = 0;
       if (x == 0) { putchar ('0') ; return ; }
       if (x < 0) { x = - x ; putchar ( '-' ) ; }
       while (x) { stk[++top] = x % 10 ; x /= 10 ; }
       while (top) { putchar ( stk[top--] + '0') ; }
       putchar ( 10 ) ;
    }

int b , g , n , ans , lb ;

signed main (int argc , char * argv[] ) {
    b = rint () ; g = rint () ; n = rint () ;
    if ( g < n ) lb = n - g ; 
    rep ( i , lb , min ( n , b ) ) ++ ans ;
    write ( ans ) ; return 0 ;
}
posted @ 2019-09-05 19:17  Phecda  阅读(182)  评论(0编辑  收藏  举报

Contact with me