深圳网站建设html5,网站建设应该注意的设计要点,自响应式网站是什么意思,如何在局域网内做网站正题
评测记录:https://www.luogu.org/recordnew/lists?uid52918pidP1311 题目大意
如果两个客栈是同样颜色且中间有客栈消费不超过p那么久算为一种方案#xff0c;求方案总数 解题思路
先枚举颜色#xff0c;然后枚举右边的#xff0c;对于左边#xff0c;记录两…正题
评测记录:https://www.luogu.org/recordnew/lists?uid52918pidP1311 题目大意
如果两个客栈是同样颜色且中间有客栈消费不超过p那么久算为一种方案求方案总数 解题思路
先枚举颜色然后枚举右边的对于左边记录两个数据一个是有多个同样颜色的k一个是有多少个选择方案y。
当枚举到一家消费不超过p的时让yk。
然后枚举到同样色调的用y来统计改变k就好了 codecodecode
#includecstdio
#includecctype
#define N 200010
#define ll long long
using namespace std;
int read() {int x0,f1; char cgetchar();while(!isdigit(c)) {if(c-)f-f;cgetchar();}while(isdigit(c)) x(x1)(x3)c-48,cgetchar();return x*f;
}
void print(int x){if (x9) print(x/10); putchar(x%1048); return;
}
ll n,k,p,color[N],cost[N],ans;
int main()
{//freopen(data.in,r,stdin);//freopen(data.out,w,stdout);nread();kread();pread();for(ll i1;in;i){color[i]read();cost[i]read();}for(ll i0;ik;i){ll k0,y0;for(ll j1;jn;j){if(cost[j]p) yk;if(color[j]i) ansy,k;if(cost[j]p) yk;}}print(ans);
}