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连试试水的深浅..... ...
随机推荐
- Python 爬虫过程中的中文乱码问题
python+mongodb 在爬虫的过程中,抓到一个中文字段,encode和decode都无法正确显示 注:以下print均是在mongodb中截图显示的,在pythonshell中可能会有所不同 ...
- Codeforces Round #336 (Div. 2) B. Hamming Distance Sum 计算答案贡献+前缀和
B. Hamming Distance Sum Genos needs your help. He was asked to solve the following programming pro ...
- 李洪强iOS开发之下载
// // // LHQDownLoader.m // A21 - 李洪强 - 下载 // // Created by vic fan on 16/7/3. // Copyright © 20 ...
- Mita和Maui
参考:http://blog.csdn.net/popeer/article/details/6002541 UI自动化的框架,MS内部使用的不对外开放的框架.UI Automation 离不开像Mi ...
- SpringMVC深入探究(1)——DispatcherServlet与初始化主线
在上一篇文章中,我们给出了构成SpringMVC应用程序的三要素以及三要素的设计过程.让我们来归纳一下整个设计过程中的一些要点: SpringMVC将Http处理流程抽象为一个又一个处理单元 Spri ...
- Java学习笔记之:Java 内部类
一.介绍 内部类:存在与类中的类就是内部类,一般用于Android开发. 可以把内部类理解成一种继承关系 1.普通内部类 2.局部内部类 3.静态内部类 4.匿名内部类 二.笔记 1.普通内部类 /* ...
- Java:IO流与IO设备
打印流:PrintWriter和PrintStream 特点:可以直接操作输入流和文件 //例子1:使用PrintStream将格式化的日期打印到文件中 import java.io.*; impor ...
- iOS:iPad和iPhone开发的异同(UIPopoverController、UISplitViewController)
iPad和iPhone开发的异同 1.iPhone和iPad: niPhone是手机,iPad.iPad Mini是平板电脑 iPhone和iPad开发的区别 屏幕的尺寸 \分辨率 UI元素的排布 \ ...
- 基于Theano的DNN框架Blocks使用简要总结
Blocks官方代码地址:https://github.com/mila-udem/blocks Blocks是加拿大Montreal大学Bengio实验室牵头开发的基于Python的神经网络模型框架 ...
- Write operations are not allowed in read-only mode
使用Spring提供的Open Session In View而引起Write operations are not allowed in read-only mode (FlushMode.NEVE ...