Zoj 3529 A Game Between Alice and Bob

自然语言处理之机器翻译:Transformer:Transformer在低资源语言翻译中的应用 Transformer模型是自然语言处理领域的一个重要突破,由Vaswani等人在2017年的论文《Attention is All You Need》中提出。它摒弃了传统的循环神经网络(RNN)和卷积神经网络(CNN)的序列依赖性,采用自注意力机制(Self-Attention)处理输入序列,极大地提高了训练效率和模型性能。 阅读详情

A Game Between Alice and Bob

Time Limit: 5 Seconds      Memory Limit: 262144 KB

Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the numbers, and replace it with one of its positive factor but not itself. The one who makes the product of all numbers become 1 wins. You can assume Alice and Bob are intelligent enough and Alice take the first turn. The problem comes, who is the winner and which number is Alice's first choice if she wins?

Input

This problem contains multiple test cases. The first line of each case contains only one number N (1<= N <= 100000) representing there are N numbers on the blackboard. The second line contains N integer numbers specifying the N numbers written on the blackboard. All the numbers are positive and less than or equal to 5000000.

Output

Print exactly one line for each test case. The line begins with "Test #c: ", where c indicates the case number. Then print the name of the winner. If Alice wins, a number indicating her first choice is acquired, print its index after her name, separated by a space. If more than one number can be her first choice, make the index minimal.

Sample Input
4
5 7 9 12
4
41503 15991 72 16057 
Sample Output
Test #1: Alice 1
Test #2: Bob


SG函数


#include<cstdio>
#include<cstring>

int SG[5100000];

int num[110000];

void fun()
{
	long long i,j,tmp;
	for(i=2;i<=5000000;i++)
	{
		if(SG[i]==0)
		{
			for(j=i;j<=5000000;j+=i)
			{
				tmp=j;
				while(!(tmp%i) && tmp)
				{
					SG[j]++;
					tmp/=i;
				}
			}
		}
	}
}

int main()
{
	fun();

	int flag,N,t=1,i;
	while(scanf("%d",&N)==1)
	{
		flag=0;
		for(i=1;i<=N;i++)
		{
			scanf("%d",&num[i]);
			flag^=SG[num[i]];
		}
		printf("Test #%d: ",t++);

		if(flag)
		{
			printf("Alice ");
			for(i=1;i<=N;i++)
			{
				if(SG[num[i]]>(flag^SG[num[i]]))
				{
					printf("%d\n",i);
					break;
				}
			}
		}
		else
			printf("Bob\n");
	}
	return 0;
}



RK3568平台YOLOv11模型部署全流程实战:环境搭建、模型转换与性能优化解析 在AI边缘计算领域,瑞芯微RK3568芯片凭借其强大的NPU算力和丰富的接口资源,成为了众多开发者的首选平台。然而,瑞芯微官方文档虽然提供了YOLO11预训练模型的部署方案,但对于需要自定义数据集训练的开发者来说,从模型训练到板端部署的完整流程却缺乏详细指导。本文将带你走完从环境搭建、数据准备、模型训练到最终板端部署的完整技术路线,并分享实际开发中遇到的各种坑点和解决方案。让我们一起探索如何在RK3568平台上实现30FPS稳定推理的YOLO11目标检测应用! 阅读详情

相关推荐

多智能体强化学习MASAC算法:从原理到PyTorch实战详解

深度强化学习通过智能体与环境的交互试错来学习最优策略,是解决复杂序列决策问题的核心技术。其核心原理在于利用价值函数或策略梯度来最大化累积奖励,在机器人控制、游戏AI等领域展现出巨大技术价值。当面对多个智能体需要协同或竞争的复杂动态环境时,单智能体算法因环境非平稳性而面临挑战,多智能体强化学习应运而生。Multi-Agent Soft Actor-Critic (MASAC) 算法融合了SAC的稳定高效与中心化训练去中心化执行的范式,通过维护中心化Critic网络和独立策略网络,有效解决了多智能体协作中的信用

weixin_30080745的博客 347

ZOJ 3529 A Game Between Alice and Bob(博弈论-sg函数)

ZOJ 3529 - A Game Between Alice and Bob Time Limit:5000MS     Memory Limit:262144KB     64bit IO Format:%lld &amp; %llu Description Alice and Bob play the following game. A ...

weixin_33853827的博客 202

告别单调!3种方法给VS2019换上VSCode同款NightOwl主题(附字体优化技巧)

本文详细介绍了三种将VSCode热门NightOwl主题移植到VS2019的方法,包括扩展市场直装、官方主题库导入与增强以及手动调色实现像素级复刻。同时提供了字体优化与视觉增强技巧,帮助开发者打造更舒适的编码环境。

weixin_28836989的博客 218

[博弈论]A Game Between Alice and Bob

Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the numbers, and replace it with one of its positive factor but not it

wu_yihao的专栏 1359

matlab相机标定_实战 | 相机标定

点击“计算机视觉life”关注,置顶更快接收消息!本文阅读时间约5分钟什么是相机标定?我们为什么需要相机标定?相机标定就是确定相机内参和外参的过程,其结果精度会直接影响视觉系统后续工作的准确性。坐标系相机标定涉及到了四大坐标系,分别为:像素坐标系图像物理坐标系相机坐标系世界坐标系为了进行相机标定,必须已知世界坐标系中足够多的三维空间点坐标,找到这些空间点在图像中投影点的二维图像坐标,并建...

weixin_39747334的博客 774

手把手教你用WKT文件在Petrel中创建自定义坐标系统(附CGCS2000转换模板)

本文详细介绍了如何在Petrel软件中利用WKT文件创建自定义坐标系统,并重点提供了CGCS2000坐标系的完整转换模板与实战步骤。通过解析坐标系统的三大支柱(大地坐标系、投影坐标系、基准转换)和WKT文件结构,指导用户从零开始构建适用于本土化项目的坐标系统,确保地质建模与空间数据处理的精度与一致性。

gpt4scribbler的博客 296

Alice and Bob

Problem Description The famous "Alice and Bob" are playing a game again. So now comes the new problem which need a person smart as you to decide the winner. The problem is as follows: They are play

笑看风云起的专栏 1470

别再死记硬背窗函数公式了!用MATLAB实战汉宁窗FIR滤波器,从频谱图看懂‘主瓣’和‘旁瓣’

本文通过MATLAB实战演示汉宁窗FIR滤波器的设计过程,帮助读者从频谱图直观理解主瓣与旁瓣的特性。文章详细对比了矩形窗与汉宁窗的频谱差异,并提供了高通滤波器设计的完整代码示例,适用于数字信号处理学习和工程应用。

weixin_30555125的博客 498

Game(思维)

Game Problem Description Alice and Bob are playing a game. The game is played on a set of positive integers from 1 to n. In one step, the player can choose a positive integer from the set, and erase...

H_usky的博客 822

AFSIM仿真系统组件开发入门:手把手教你扩展传感器与武器模型

本文为AFSIM仿真系统组件开发入门指南,手把手教你如何扩展传感器与武器模型。通过深入解析AFSIM基于组件的体系结构,并结合构建自定义电子扫描阵列雷达传感器和协同交战智能武器系统两个实战案例,详细介绍了从C++插件开发、MATLAB算法集成到脚本接口暴露的完整流程,帮助你掌握定制AFSIM仿真的核心能力。

t8u9v0w1x的博客 504

【论文精度】生成式预训练模型——BART(Bidirectional and Auto-Regressive Transformers)

​ BART是一个预训练的seq2seq的去噪自编码(denoising autoencoder)模型,BART以下方式进行训练①用任意的噪声函数(noising function)去破坏文本;②学习一个模型来重建原始文本。它使用一个标准的基于transformer的神经机器翻译架构,可以看作是BERT(双向编码器)、GPT(left-to-right解码器)以及其他预训练方案的推广。

weixin_45828972的博客 7465

zoj3529 A Game Between Alice and Bob 质因子个数NIM

A Game Between Alice and Bob Time Limit: 5 Seconds      Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take tur

Shirley 1662

宇树G1二次开发资料汇总

宇树科技G1是一款29自由度的商业级人形机器人,配备NVIDIA Jetson Orin NX计算平台和完整SDK生态。本文系统介绍了G1的硬件架构、29个关节配置、传感器外设、双计算单元设计等关键信息,并详细解析了软件生态体系,包括C++/Python SDK、ROS2接口、仿真工具和AI框架。开发者可通过DDS通信实现高层运动控制或底层关节级精确控制,支持快速二次开发。文档提供了网络配置、接口调用示例等实用指南,帮助开发者高效利用该平台进行人形机器人应用开发。

m0_47999117的博客 1346

ZOJ 3529 A Game Between Alice and Bob

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3529Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the nu

long-long-ago 495

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

A Game Between Alice and Bob(zoj 3529)

题目戳这里 题目大意是:给你n个数字,两个人lunl

23333333 659

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

zoj3529 A Game Between Alice and Bob

A Game Between Alice and Bob Time Limit: 5 Seconds Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns ch

习惯与规则决定命运 1496

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

ZOJ 3529 A Game Between Alice and Bob 博弈好题

A Game Between Alice and Bob Time Limit: 5 Seconds      Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take tur

hnust_xiehonghao的专栏 1892

ZOJ - 3529 A Game Between Alice and Bob 数论+博弈

题目:有N堆石头,每次选中某一堆,把数量替换成原先的因子。全部为1则结束。 思路:每个数都有一定数量的质因子数目,将其替换成因子,就相当于拿走了几个质因子,就转换成了NIM博弈,每堆石子的个数为该数的质因子的数目。 代码: #pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #includ

ACVevtor的博客 447

ZOJ 3529 A Game Between Alice and Bob(SG)

                                                                         A Game Between Alice and Bob                                                       Time Limit: 5 Seconds      Memory Limit: 26...

shyoldman的博客 292

zoj3529 A Game Between Alice and Bob 博弈

N个数字,两人轮流操作,每次操作ke

Broken Wings 703

ZOJ 3529 A Game Between Alice and Bob 博弈好题

A Game Between Alice and BobTime Limit: 5 Seconds Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choos...

weixin_30955617的博客 112

ZOJ3529_A Game Between Alice and Bob

题目的意思是给你若干个数字,两个游戏者轮流操作,每次可以将该数变为一个小于当前的一个约数,无法操作的游戏者fail。 和其他的博弈题目大同小异吧。 不同点有两个,逐一分析吧。 一、每次改变一个数只能改变为小于当前数的约数,所以相对来说Sg函数值得求法有点不同哦。自己打个表就可以发现这个题目的Sg函数值是该数的除了1以为的约数的个数。这样我们可以用一点数论的知识把Sg函数值搞定了。 ...

weixin_30600503的博客 141

ZOJ - 3529 A Game Between Alice and Bob 尼姆博弈+质因子个数

题目链接:点击查看 题意:给出n个数,每轮可以把某个数变成他的因子,先手获胜输出Alice 和 他第一次可以操作的最靠前的数字 题解:把这个数变成他的因子,这不就相当于,除掉了几个质因数吗,这不就是取掉几个石子吗,这不就是尼姆博弈吗,为啥当时脑子瓦特了。。。。 #include<bits/stdc++.h> using namespace std; typedef long l...

还我笑颜 221

zoj 3529 A Game Between Alice and Bob 博弈论

思路:每个数的SG值就是其质因子个数,在进行nim博弈 代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<algorithm> 5 #include<cstring> 6 #include<se...

weixin_30636089的博客 116

ZOJ 3529 A Game Between Alice and Bob (数论+SG博弈)

转载请注明出处,谢谢 http://blog.csdn.net/ACM_cxlove?viewmode=contents           by---cxlove 题意:有N堆石头,每次选中某一堆,把数量替换成原先的因子。全部为1则结束。 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4464 乍一看,SG博弈

窝不是爱酱,喵~~~~ 2672
上一篇: Hdu 1729 Stone Game
下一篇: ural 1108 Binary Apple Tree
Magic_____
博客等级 码龄14年 11粉丝 160原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址