You are the gym teacher in the school. There are nn students in the row. And there are two rivalling students among them. The first one is in position aa, the second in position bb. Positions are numbered from 11 to nn from left to right. Since they…
题意:给你n个人和两个尖子生a,b,你可以操作k次,每次操作交换相邻两个人的位置,求问操作k次以内使得ab两人距离最远是多少 题解:贪心尽可能的将两人往两边移动,总结一下就是min(n-1,|a-b|+x) 代码: #include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int T; int n,m,a,b; int main() { scanf("%d",…
传送门 A. Two Rival Students 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/13 22:37:26 */ #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #defi…
题目链接:https://codeforces.com/problemset/problem/1256/A A. Payment Without Change time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have aa coins of value nn and bb coins of value 11. You a…
CF Educational Round 78 (Div2)题解报告A~E A:Two Rival Students 依题意模拟即可 #include<bits/stdc++.h> using namespace std; int T; int n, x, a, b; int main() { cin >> T; while(T--) { cin >> n >> x >> a >> b; if(a > b) swap(a, b…
原文地址:http://www.mimno.org/articles/ml-learn/ written by david mimno One of my students recently asked me for advice on learning ML. Here’s what I wrote. It’s biased toward my own experience, but should generalize. My current favorite introduction is…
染色判读二分图+Hungary匹配 The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1705 Accepted Submission(s): 821 Problem Description There are a group of students. Some of them…