题目链接:http://codeforces.com/gym/101147 2017/8/27日训练赛,题目情况9/11,Rank 4/79. A. The game of Osho 题意:定义一个子游戏,B,N可以从N减掉B^k要求B^k小于等于N,当N变成0,该哪个人选,哪个人就输了,给出G个这样的游戏,问最后的输赢情况. 解法:组合游戏,SG打表发现规律,然后求Nim和判断即可. #include <bits/stdc++.h> using namespace std; typedef…
A.The game of Osho(sg函数+二项展开) 题意: 一共有G个子游戏,一个子游戏有Bi, Ni两个数字.两名玩家开始玩游戏,每名玩家从N中减去B的任意幂次的数,直到不能操作判定为输.问谁最终能赢. 题解: GYM - 101147 A.The game of Osho #include <bits/stdc++.h> using namespace std; int t; int g; int b, n; int ans; int main() { freopen("…
ACM-ICPC Asia Beijing Regional Contest 2018 Reproduction hihocoder1870~1879 A 签到,dfs 或者 floyd 都行. #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair<int,int> pii; typedef pair<LL,int>…
Conquer a New Region Time Limit: 5 Seconds Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
摘要 本文主要给出了2014-2015 ACM-ICPC, Asia Xian Regional Contest的部分题解,说明了每题的题意.解题思路和代码实现,意即熟悉区域赛比赛题型. Built with Qinghuai and Ari Factor 题意 判断是否是Q数列,只要数列中每个数均能够被3整除就是Q数列. 解题思路 需要特判一下0的情况. 代码 #include <cstdio> int main() { int T; int n; ; scanf("%d"…
摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其他区域赛的准备有借鉴意义. Function and Function 题意 给出x和k,计算gk(x). 解题思路 通过观察发现,g函数经过一定次数的递推一定会在0和1之间变换,所以循环内加判断提前结束递推即可. 易错分析 注意计算f(0)返回的是1的问题,下面的写法避免了这种错误. 代码实现 #…
The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using namespace std; #define maxn 3000005 char a[maxn],b[maxn]; int c[maxn],ll[maxn],rr[maxn]; int main(){ int t; cin>>t; while(t--){ int n; scanf("%d&qu…
2017-2018 ACM-ICPC, Asia Tsukuba Regional Contest A Secret of Chocolate Poles 思路:暴力枚举黑巧克力的个数和厚黑巧克力的个数 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define s…
2014-2015 ACM-ICPC, Asia Tokyo Regional Contest A B C D E F G H I J K O O O O O O A - Bit String Reordering 签到 #include <bits/stdc++.h> using namespace std; ; ]; int temp[N]; int put(int opt) { ] = {}; ; ; i <= m; i++) { int num = p[i];…
A. Within Arm's Reach 留坑. B. Bribing Eve 枚举经过$1$号点的所有直线,统计直线右侧的点数,旋转卡壳即可. 时间复杂度$O(n\log n)$. #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int N=2000010; const double eps=1e-7; int _,n,i,x,y,at_center,X,…
A. Arranging Hat $f[i][j]$表示保证前$i$个数字有序,修改了$j$次时第$i$个数字的最小值. 时间复杂度$O(n^3m)$. #include <bits/stdc++.h> using namespace std ; typedef long long LL ; #define clr( a , x ) memset ( a , x , sizeof a ) typedef pair<int,int>pi; char ten='9'+1; int n,…
Performance ReviewEmployee performance reviews are a necessary evil in any company. In a performance review, employees give written feedback about each other on the work done recently. This feedback is passed up to their managers which then decide pr…
题目链接 Codefores_Gym_101164 Solved 6/11 Penalty Problem A Problem B Problem C Problem D Problem E Problem F 预处理出一个pre数组 pre[i]表示i位字母数以内用掉多少个字母 然后就可以算出要计算的位置是第多少个字母数 最后就是转成26进制了 注意是没有0有26的26进制 #include<iostream> #include<cstdio> #include<cma…
A. Anniversary Cake 随便挑两个点切掉就好了. #include<bits/stdc++.h> using namespace std; const int Maxn=200020; typedef long long LL; typedef pair<int,int>pi; pi a[2]; int main() { freopen("anniversary.in","r",stdin); freopen("an…
The Problem to Slow Down You Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93645#problem/G Description http://7xjob4.com1.z0.glb.clouddn.com/76e435d3c21fa3cbeef1e76780086dc4 Input Output Sample In…