【codeforces 794A】Bank Robbery

【题目链接】:http://codeforces.com/contest/794/problem/A

【题意】

每个位置上可能有物品(>=1)或是没物品
你一开始在某一个位置b;
然后你最左可以往左走到a(a< b)
最右可以往右走到c(b< c);
然后问你a..c这区间里面有多少个物品;

【题解】

傻逼题

【Number Of WA

0

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)

typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;

int a,b,c;
int n;

int main()
{
    //freopen("F:\\rush.txt","r",stdin);
    ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
    //init??????
    cin >> a >> b >> c;
    cin >> n;
    int ans = 0;
    rep1(i,1,n)
    {
        int x;
        cin >> x;
        if (x>b && x<c)
            ans++;
    }
    cout << ans << endl;
    return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/7626321.html