#42011: cpp借放


dvbdarcyvolleyball@gmail.com (no love)

學校 : 新北市私立南山高級中學
編號 : 266888
來源 : [36.229.126.61]
最後登入時間 :
2024-10-22 22:00:21
f605. 1. 購買力 -- 2021年1月APCS | From: [123.252.121.18] | 發表日期 : 2024-09-19 20:15

 隨便寫

#include <bits/stdc++.h> //e465
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, d, ans = 0, count = 0;
  cin >> n >> d;
  int a[n][3];
  for(int i = 0;i < n;i++){
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  for(int i = 0;i < n;i++){
    if(abs(a[i][0] - a[i][1]) >= d || abs(a[i][0] - a[i][2]) >= d || abs(a[i][1] - a[i][2]) >= d){
      ans += (a[i][0] + a[i][1] + a[i][2]) / 3;
      count++;
    }
  }
  cout << count << " " << ans << "\n";
}

 
ZeroJudge Forum