TLE里说丰年,看取TLE一片
  • 板块P1102 A-B 数对
  • 楼主lizishi
  • 当前回复3
  • 已保存回复3
  • 发布时间2025/1/18 20:15
  • 上次更新2025/1/18 23:20:44
查看原帖
TLE里说丰年,看取TLE一片
1165586
lizishi楼主2025/1/18 20:15
Advertisement 1Advertisement 2
明月别枝惊TLE,清风半夜鸣TLE。TLE里说丰年,看取TLE一片。七八个TLE外,两三点TLE前。旧时TLE社林边,路转TLE忽见。#include using namespace std; int main() {for (int i = 1; i <= 10; i++) if (2 <= i && i <= 4) cout << "TLE"; else cout << "AC"; return 0;}
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, c;
    int cnt = 0;
    cin >> n >> c;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    for (int i = n - 1; i > 0; i--) {
        for (int j = i - 1; j >= 0; j--) {
            if (a[i] - a[j] == c) cnt++;
        }
    }
    cout << cnt;
    return 0;
}
2025/1/18 20:15
加载中...