社区讨论
2,3,4测试点全TLE,求调qwq
P1102A-B 数对参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @lo247g8h
- 此快照首次捕获于
- 2023/10/23 07:43 2 年前
- 此快照最后确认于
- 2023/11/03 08:03 2 年前
CPP
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=2*1e5+99;
int a[MAXN];
int n,c;
bool AC(int a1,int b1){
if(a1-b1==c){
return 1;
}
return 0;
}
int ans=0;
signed main(){
ios::sync_with_stdio(false);
cin>>n>>c;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(a[i]<c){
continue;
}
for(int j=0;j<n;j++){
if(i!=j){
if(AC(a[i],a[j])){
ans++;
}
}
}
}
cout<<ans;
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...