codeforce Codeforces Round #201 (Div. 2)
cf 上的一道好题; 首先发现能生成所有数字-N 判断奇偶 就行了,但想不出来,如何生成所有数字,解题报告 说是 所有数字的中最大的那个数/所有数字的最小公倍数,好像有道理;纪念纪念;
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std; int arr[112];
int gcd( int a,int b ){
if( b == 0 )return a;
else return gcd( b,a%b );
}
int main( )
{
int N;
while( scanf("%d",&N) != EOF )
{
for( int i = 1; i <= N; i++ ){
scanf("%d",&arr[i]);
}
sort( &arr[1],&arr[1]+N );
int t = arr[1];
for( int i = 2; i <= N; i++ )
t = gcd( t,arr[i] );
N = arr[N]/t - N;
if( N%2 )puts("Alice");
else puts("Bob");
}
return 0;
}
codeforce Codeforces Round #201 (Div. 2)的更多相关文章
- Codeforces Round #201 (Div. 2) - C. Alice and Bob
题目链接:http://codeforces.com/contest/347/problem/C 题意是给你一个数n,然后n个数,这些数互不相同.每次可以取两个数x和y,然后可以得到|x - y|这个 ...
- Codeforces Round #201 (Div. 2)C,E
数论: C. Alice and Bob time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Codeforces Round #201 (Div. 2). E--Number Transformation II(贪心)
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description You ar ...
- Codeforces Round #533 (Div. 2)题解
link orz olinr AK Codeforces Round #533 (Div. 2) 中文水平和英文水平都太渣..翻译不准确见谅 T1.给定n<=1000个整数,你需要钦定一个值t, ...
- Codeforces Round #633 (Div. 2)
Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
随机推荐
- ThreadPoolTaskExecutor异步的处理报警发送邮件短信比较耗时的东东
package com.elong.ihotel.util; import org.springframework.beans.factory.DisposableBean; import org.s ...
- UVA 10341 二分搜索
Solve the equation:p ∗ e−x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x2 + u = 0where 0 ≤ x ≤ 1.In ...
- MyEclipse — Maven+Spring+Struts+Hibernate 整合 [学习笔记-1]
示例数据库test,用户信息表
- linux下tigervnc-servere服务的安装与使用
关于tigervnc-servere的安装,可以直接使用本地yum源进行安装. [root@ ~]# yum install tigervnc-server -y 其中tigervnc的主要配置文件位 ...
- PowerMockito(PowerMock用法)
网络上大部分是powermock 的用法, PowerMock有两个重要的注解: –@RunWith(PowerMockRunner.class) –@PrepareForTest( { YourCl ...
- Linux下TOmcat调试命令
1.显示linux系统的环境变量:env命令,会显示JAVA_HOME,Catalina,CLASSPATH等系统变量 2.
- unix:///tmp/supervisor.sock no such file
运行supervisorctl时保错, 修改/etc/supervisor/supervisor.conf文件 将file=/var/run/supervisor.sock 修改为/tmp/super ...
- VS2010/MFC编程入门之五(MFC消息映射机制概述)
VS2010/MFC编程入门之五(MFC消息映射机制概述)-软件开发-鸡啄米 http://www.jizhuomi.com/software/147.html 上一讲鸡啄米为大家简单分析了MFC应用 ...
- 自由软件VS开源软件
自由软件VS开源软件 “自由软件运动”是一项倡导软件这种知识产品应该免费共享的社会运动,它主要是从社会伦理学,道德的高度,强调我们每个人都有自由使用软件的权利.这种权利不应该被软件私有所破坏. 反对软 ...
- 【总结】杂谈Java异常处理
软件开发中一个古老的说法是:80%的工作使用20%的时间.80%是指检查和处理错误所付出的努力.在许多语言中,编写检查和处理错误的程序代码很乏味,并使应用程序代码变得冗长.原因之一就是它们的错误处理方 ...