VP时间
A.找到最小,计算最小有几个
n-cnt;
1.ac
B.结论
模拟会超时
n&1:
n/2;相遇A继续走,B跳两格到n/2+1(n/2-1->n/2+1)
k n>k>n/2输出k+1 模拟一下 1234,12345 !n&1不会改变位置,直接输出k%n n&1 找什么时刻会发现冲突 每一个周期冲突2次, C. 偶数队伍就需要0 奇数队伍就1,-1,1,-1交替 D. 消C a=sqrt(2*b+1); c=b+1; 找范围暴力算 b<=n a<=sqrt(2*n+1); c<=n-1 n=1e9 min(n,1e5+9); 枚举a !(pow(a,2)-1%2)ans++; 题解 A. B. 根据行动路线可以画一个环 偶数环 (n=4)可以发现它们不会相遇,在k时刻时cout<<(k%n?k%n:0)<<'\n'; or (k-1)mod n+1 k==n时 nmodn=0;不正确 (故k-1) 奇数环 (n=5)可以发现相遇周期(t=(n-1/2))就是走k步后又多走(k/(t))步,防止(k==0) 因此cout<<(k-1+(k-1/(t)))%n+1<<'\n'; C. 一共n个队 积分应该是kn分 每个队平均下来k分 胜负场x场 平局场y场 所以存在下面两个式子 得到 要求平局数最小 故k最大 当n为奇数时, 当n为偶数时, D.
// Problem: A. Arena
// Contest: Codeforces - Educational Codeforces Round 104 (Rated for Div. 2)
// URL: https://codeforces.com/group/RAx5fiilkP/contest/1487/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include
// Problem: B. Cat Cycle
// Contest: Codeforces - Educational Codeforces Round 104 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1487/problem/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include
,
,
,每个队赢
把
,
,
,每个队赢
把
// Problem: C. Minimum Ties
// Contest: Codeforces - Educational Codeforces Round 104 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1487/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include
// Problem: D. Pythagorean Triples
// Contest: Codeforces - Educational Codeforces Round 104 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1487/problem/D
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include