蓝桥杯(3.7)

P1102 A-B 数对

java 复制代码
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int c = sc.nextInt();
		int[] res = new int[n+1];
		for(int i=1;i<=n;i++)
			res[i] = sc.nextInt();
		int sum = 0;
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) {
				if((res[i]-res[j]) == c) {
					sum++;
				}
			}
		}
		System.out.println(sum);
	}
}
相关推荐
xcl09253 小时前
北京24小时自助健身房系统软件开发实战:从架构到部署全流程指南
java·spring boot·架构
一 乐5 小时前
动漫书销售商城|基于springboot + vue动漫书销售商城(源码+数据库+文档)
java·数据库·vue.js·spring boot·毕业设计
卓怡学长5 小时前
w214基于jsp知道特产网
java·intellij-idea
步行cgn5 小时前
Spring 注解使用详解
java·spring
一条小小yu5 小时前
Spring IoC的理解
java·后端·spring
落魄实习生6 小时前
Agent Scope Java 2.x 系列【7】工具使用
java·开发语言·ai
旺仔学长 哈哈6 小时前
springboot钓鱼爱好者交流平台APP设计与实现
java·spring boot·mysql·充电桩管理系统
自强的小白7 小时前
核心功能(Service接口)
java·mybatis
财情双生教练易和中7 小时前
“找矿大会战”产业链,量化统计研究报告
职场和发展·职业发展·创业创新·程序员创富