1、T557802 062-14-C01-取硬币游戏
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while(cin>>n&&n!=0) {
if(n<=2) cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
return 0;
}
2、T553290 06-14-C02-遥控机器人
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int solve(){
ll d,k,n,x,y;
cin>>d>>k;
n=d/(sqrt(2)*k);
x=(n+1)*k;
y=n*k;
if(x*x+y*y>d*d){
cout<<"Bob"<<'\n';
}else{
cout<<"Alice"<<'\n';
}
return 0;
}
int main()
{
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
3、T553291 06-14-C03-欧几里德游戏
#include <bits/stdc++.h>
using namespace std;
bool f(int x,int y){
if(x<y){
swap(x,y);
}
if(x%y==0){
return 1;
}
if(x<2*y){
return !f(x-y,y);
}
return 1;
}
int main()
{
int x,y;
cin>>x>>y;
if(f(x,y)){
cout<<"Alice wins";
}else{
cout<<"Bob wins";
}
return 0;
}
4、T553292 06-14-C04-Nim取石头游戏
#include <bits/stdc++.h>
using namespace std;
int n,a[105],t;
int main()
{
int i,j;
cin>>n;
cin>>a[1];
t=a[1];
for(int i=2;i<=n;i++){
cin>>a[i];
t^=a[i];
}
if(t==0){
cout<<"B wins";
return 0;
}
cout<<"A wins"<<'\n';
int k=31;
while(!(t&1<<k)){
k--;
}
for(int i=1;i<=n;i++){
if(a[i]&1<<k){
j=i;
break;
}
}
cout<<j<<" "<<a[j]-(a[j]^t)<<'\n';
return 0;
}
5、T553293 06-14-C05-改数游戏
#include <bits/stdc++.h>
using namespace std;
long long n,a[100],b[100],t;
int main()
{
int i,j,x=0;
cin>>n;
while(n)
{
b[++x]=n%10;
n/=10;
}
for(i=1;i<=x;i++){
t^=b[i];
}
if(t==0){
cout<<"B wins";
return 0;
}
cout<<"A wins"<<'\n';
int k=6;
while(!(t&1<<k)){
k--;
}
for(i=1;i<=x;i++){
if(b[i]&1<<k){
j=i;
break;
}
}
cout<<j<<" "<<(b[j]^t)<<'\n';
return 0;
}
6、T557803 062-14-D01-Nim取石头游戏(2)
#include <bits/stdc++.h>
using namespace std;
void solve(int n)
{
int a[105],t;
int i,j;
cin>>a[1];
t=a[1];
for(int i=2;i<=n;i++){
cin>>a[i];
t^=a[i];
}
if(t==0){
cout<<"0"<<'\n';
return;
}
int ans=0;
for(int i=1;i<=n;i++){
if((a[i]^t)<a[i]){
ans++;
}
}
cout<<ans<<'\n';
return;
}
int main()
{
int n;
while(cin>>n){
if(n==0)break;
solve(n);
}
}

【数学基础】03-初等几何
https://www.luogu.com.cn/training/675204#problems
https://blog.csdn.net/dllglvzhenfeng/article/details/156864234
第8章 组合数学《C++编程与信息学竞赛数学基础》
https://blog.csdn.net/dllglvzhenfeng/article/details/156614120


762

被折叠的 条评论
为什么被折叠?



