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连试试水的深浅..... ...
随机推荐
- (3)初次接触off
boss布置任务了,要读入off文件,生成能显示出来的可执行文件,完成不了就要滚蛋 目前的东西还是不用保密的,到后面我就要设密码了 好,.off文件是什么? OFF,Object File Forma ...
- Understanding node.js
Node.js has generally caused two reactions in people I've introduced it to. Basically people either ...
- 【poj2891-Strange Way to Express Integers】拓展欧几里得-同余方程组
http://poj.org/problem?id=2891 题意:与中国剩余定理不同,p%ai=bi,此处的ai(i=1 2 3 ……)是不一定互质的,所以要用到的是同余方程组,在网上看到有人称为拓 ...
- PLSQL:plsql中文乱码,显示问号
PLSQL执行sql语句,不识别中文,输出的中文标题显示成问号???? 1. 登陆plsql,执行sql语句,输出的中文标题显示成问号????:条件包含中文,则无数据输出
- C#日期大全
DateTime dt = DateTime.Now; // Label1.Text = dt.ToString();//2005-11-5 13:21:25 // Label2.Text = dt. ...
- Android ActionBar详解
Android ActionBar详解 分类: Android2014-04-30 15:23 1094人阅读 评论(0) 收藏 举报 androidActionBar 目录(?)[+] 第4 ...
- CentOS下判断自己的VPS是OpenVZ的还是Xen的
一般来说,VPS的虚拟化技术,有Xen.OpenVZ.Xen HVM和VMware这几种,那么,如何判断自己的VPS是基于哪种虚拟化技术的呢? 1.执行:ls /proc/命令,一般Xen的VPS,/ ...
- Android 【问题汇总】列表数组越界的问题
遇到了一个诡异的问题,ListView发生数组越界(偶尔会),程序崩溃. 错误信息如下: W/dalvikvm( ): threadid=: thread exiting with uncaught ...
- C# 字符串计算表达式
C# 字符串计算表达式 string str="4+4+2.1"; 要的效果: double sum=4+4+2.1: 方案一: 动态计算表达式: 1 public class ...
- 监听Activity进入后台(最小化),并根据时间判断是否超时,此解决办法可用于超时重登陆
通过重写一个继承自Activity的基类中的onUserLeaveHint()方法,当用户按Home键等操作使程序进入后台时即开始计时,当用户使程序恢复为前台显示时执行onResume()方法,在其中 ...