The 43 rd ACM Asia Nanjing Regional Contest

https://vj.ti12z.cn/b02428b1bbcf4609f7b121c06ef01b09?v=1564291265

A.

思路
当K为1时显然的和N的奇偶性有关,那么我们考虑一下K>1 K>1K>1的情况
对于先手的Adrien来说,他对任意的N颗石子,他都可以将这N颗石子分成两段相当数量的石子(从中间开始拿对于奇数拿一颗,对于偶数拿两颗),那么剩下的两段相当于是独立的两个相同的游戏了,如果后手拿其中一段,那么我先手就对另一段进行这样相同的拆分,那么能保证我先手总是有石子能拿,所以我先手必胜,也就是说当K>1 K>1K>1的时候先手必胜,K==1 K==1K==1的时候判断奇偶,N==0 N==0N==0的时候特判即可

#include <bits/stdc++.h>
using namespace std;

int n,k;
int main() {
    while (~scanf("%d%d", &n, &k)) {
        if (n == 0) {
            printf("Austin\n");
            return 0;
        }
        if (k == 1) {
            if (n % 2 == 0) {
                printf("Austin\n");
            } else {
                printf("Adrien\n");
            }
        } else {
            printf("Adrien\n");
        }
    }
}

G.

题解:

原文地址:https://www.cnblogs.com/Accpted/p/11279856.html

时间: 2024-08-01 11:17:04

The 43 rd ACM Asia Nanjing Regional Contest的相关文章

The 43rd ACM International Collegiate Programming Contest Asia Shenyang Regional Contest

The 43rd ACM International Collegiate Programming Contest Asia Shenyang Regional Contest 原文地址:https://www.cnblogs.com/Accpted/p/11298233.html

2018-2019, ICPC, Asia Yokohama Regional Contest 2018 (Gym - 102082)

2018-2019, ICPC, Asia Yokohama Regional Contest 2018 A - Digits Are Not Just Characters 签到. B - Arithmetic Progressions 题意:从给定的集合中选出最多的数构成等差数列. 题解:数字排序后,设\(dp[i][j]\)表示等差数列最后一个数字为\(a[i]\),倒数第二个数字为\(a[j]\)的最大个数.然后对于每一位枚举 \(i\),\(lower\_bound()\)找有无合法的

The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online - H Traveling on the Axis-【思维模拟题目】

H Traveling on the Axis 作者: 浙江大学竞赛命题组 单位: ACMICPC 时间限制: 500 ms 内存限制: 64 MB 代码长度限制: 32 KB 传送门 BaoBao is taking a walk in the interval [0,n] on the number axis, but he is not free to move, as at every point (i−0.5) for all i∈[1,n], where i is an intege

2017-2018 ACM-ICPC, Asia Daejeon Regional Contest

C 有n个节点和m边条,求一条最长的路径,该路径(c1,c2,c3...cn)满足 不出现重复的节点,ci 和ci+1是邻居节点,且 ci 的邻居节点数量小于ci+1的邻居节点数量. 记忆DFS遍历,每次递归计算的值都保存在数组里,这样复杂度相当于O(m) 1 #include <bits/stdc++.h> 2 #define INF 0x3f3f3f3f 3 #define ll long long 4 using namespace std; 5 const int N = 1e5+10

2018 ACM-ICPC, Asia Shenyang Regional Contest CEJ

C. Insertion Sort 求有多少 1 到 n 的排列 满足条件将前 k 个的数排列以后 最长上升子序列长度为 n?1 以上 队友推了式子 试了下就过了 1 #include<bits/stdc++.h> 2 typedef long long ll; 3 using namespace std; 4 5 ll ans,n,k,p; 6 7 ll PP() 8 { 9 ll sum=1; 10 for(int i=1;i<=k;i++) 11 sum=(sum*i)%p; 12

2018-2019 ACM-ICPC, Asia Shenyang Regional Contest(补题)

A题 - Sockpuppets 未补 B题 - Sequences Generator 未补 C题 - Insertion Sort 签到题之一,排列计数. 题意:给你排列的长度$n$,要求你求出排列的个数,满足对其前k项排序后其最长上升子序列至少为$n-1$. 解决:当最长上升子序列为$n$时答案明显时$k!$,为$n-1$时,相当于将$n$长的有序序列中某一个位置的数插到另一个位置去,但因为会对前$k$个排序,所以在挪动时要保证前$k$个有序即可.接下来你可以暴力求出这个值,也可以手推,这

2018-2019 ACM-ICPC, Asia Seoul Regional Contest

ProblemA Circuits Solved. 题意: 有$n$个矩形,可以放两条平行与$x$轴的线,求怎么放置两条无线长的平行于$x$轴的线,使得他们与矩形相交个数最多 如果一个矩形同时与两条线相交,只算一次. 思路: 离散化后枚举一根线,另一根线用线段树维护,扫描线思想 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 #define N 400010 5 int n; 6 int b[N]; 7 int x[N], y[N];

Asia Yokohama Regional Contest 2018 B题 - Arithmetic Progressions(dp)

https://codeforces.com/gym/102082 题意 给定一些数,可以重新排序,求其中最长的等差数列的长度 思路 d[i][j]表示以a[i]和a[j]为开头的等差数列的最大长度,具体见代码 1 #define bug(x,y) cout<<"i="<<x<<": "<<y<<endl 2 #define IO std::ios::sync_with_stdio(0); 3 #inclu

2018-2019 ACM-ICPC, Asia Dhaka Regional Contest

目录 Contest Info Solutions B. Counting Inversion C. Divisors of the Divisors of An Integer E. Helping the HR F. Path Intersection G. Techland H. Tile Game J. VAT Man Contest Info Practice Link Solved A B C D E F G H I J 7/10 - O O - O O O ? - O O 在比赛中