A
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define mst(a, b) memset(a, b, sizeof a)
#define REP(i, x, n) for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
LL k, n, t;
int main(){
scanf("%lld%lld%lld", &n, &k, &t);
LL a = k + (n - k) + k;
t %= a;
if(t <= k) {
printf("%lld\n", t);
} else if(t <= k + (n - k)) {
printf("%lld\n", k);
} else {
t = t - k - (n - k);
printf("%lld\n", k - t);
}
return 0;
}
B
题意:给出a,b,c三个点,要求在平面中选择一个点,以这点为中心把平面旋转某个角度后,a点位于原来b点的位置,b点位于原来c点的位置
思路:很显然要求ab = bc,但要排除a b c在同一直线上的情况
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define mst(a, b) memset(a, b, sizeof a)
#define REP(i, x, n) for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
LL x[3], y[3];
int main(){
for(int i = 0; i < 3; ++i) {
scanf("%lld%lld", x + i, y + i);
}
LL a = (x[1] - x[0]) * (x[1] - x[0]) + (y[1] - y[0]) * (y[1] - y[0]);
LL b = (x[1] - x[2]) * (x[1] - x[2]) + (y[1] - y[2]) * (y[1] - y[2]);
if(a != b) {
puts("No");
return 0;
}
sort(x, x + 3);
sort(y, y + 3);
bool f = false;
if(x[0] - x[1] != x[1] - x[2]) f = true;
if(y[0] - y[1] != y[1] - y[2]) f = true;
if(f) puts("Yes");
else puts("No");
return 0;
}
C
题意:给出n个五维坐标点,要求出所有good点,题目中给出的是bad的点的定义,他是说如果平面中存在两个点b,c ,如果向量ab与向量ac的夹角严格小于90度,则他是个bad点,求出所有good点
思路:其实这题我们只考虑good点也就可以了,good点的要求其点与其他任意两点连成向量的夹角要大于等于90度,我们考虑2维坐标的情况,很显然此时最多只能存在4个点,才能使得满足是good点,把这个点看成坐标原点,四个点落在x轴正负半轴上和y轴正负半轴上,那么我们也可以猜想在5维状态下大于某个值之后就不存在good点
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define mst(a, b) memset(a, b, sizeof a)
#define REP(i, x, n) for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e3 + 10;
const double PI = acos(-1.0);
const double eps = 1e-8;
LL point[qq][5];
LL
int n;
int id[qq];
int a[5], b[5];
bool Judge(int x, int y, int z) {
int ans = 0;
for(int i = 0; i < 5; ++i) {
a[i] = point[y][i] - point[x][i];
b[i] = point[z][i] - point[x][i];
ans += a[i] * b[i];
}
return ans > 0 ? false : true;
}
int main(){
scanf("%d", &n);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < 5; ++j) {
scanf("%d", &point[i][j]);
}
}
if(n > 100) {
puts("0");
return 0;
}
int k = 0;
for(int i = 0; i < n; ++i) {
bool f = false;
for(int j = 0; j < n; ++j) {
if(i == j) continue;
for(int k = 0; k < n; ++k) {
if(k == j || k == i) continue;
if(Judge(i, j, k) == false) f = true;
}
}
if(!f) id[k++] = i + 1;
}
printf("%d\n", k);
for(int i = 0; i < k; ++i) {
printf("%d ", id[i]);
}
puts("");
return 0;
}