19685 握手问题
⭐️难度:简单
🌟考点:2024、省赛、数学
📖
📚
package test ;import java.util.Scanner;
public class Main {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = 50;int sum1 = 43 * 7; // 7 个人的握手次数int sum2 = 0 ;for (int i = 43; i >=1 ; i--) { // 剩下43个人的握手次数sum2 += (i - 1);}System.out.println(sum1 +sum2);//1204}
}