gcd裸题,不过输入要注意gets会tle,要用快速读入

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll a[N];
ll gcd(ll a,ll b)
{
if(a<b)swap(a,b);
return b?gcd(b,a%b):a;
}
int main()
{
/* ios::sync_with_stdio(false);
cin.tie(0);*/
ll n,ans=;
scanf("%d",&n);
while (getchar() != '\n');
while (n --) {
char buf;
int cnt = ;
while ((buf = getchar()) != '\n')
if (buf >= '' && buf <= '') {
ungetc(buf,stdin);
scanf("%d",&a[cnt++]);
}
ll ans=;
for(int i=;i<cnt;i++)
for(int j=i+;j<cnt;j++)
ans=max(ans,gcd(a[i],a[j]));
printf("%lld\n",ans);
}
return ;
}
/*********************
3
10 20 30 40
7 5 12
125 15 25
*********************/

uva11827gcd的更多相关文章

随机推荐

  1. Linux上添加服务(htttpd,samba等等)

    service httpd restart   出现 httpd:unrecognized service 错误 vi /etc/rc.d/rc.local #在/etc/rc.d/rc.local中 ...

  2. appium入门基础知识

    1.概念区分: 1)IOS-UIAutomation:随着iOS4.0的发布,苹果公司同时发布了一个名为UIAutomation的测试框架,它可以用来在真实设备和iPhone模拟器上执行自动化测试 学 ...

  3. Python生成器是什么

    生成器是 Python 初级开发者最难理解的概念之一,虽被认为是 Python 编程中的高级技能,但在各种项目中可以随处见到生成器的身影,你得去理解它.使用它.甚至爱上它. 提到生成器,总不可避免地要 ...

  4. windows下的Mysql安装与基本使用(msi)

    一.安装方式 1.msi(其他版本:https://www.cnblogs.com/zjiacun/p/6653891.html) 2.zip 这里我们用msi吧,只是单纯练习的话,简单很多 二.ms ...

  5. git命令集合

    git init # 初始化本地git仓库(创建新仓库) git config --global user.name "xxx" # 配置用户名 git config --glob ...

  6. R语言seq()函数用法

    1.seq() 用来生成一组数字的函数. Usage: ## Default S3 method:seq(from = 1, to = 1, by = ((to - from)/(length.out ...

  7. linux安装tree命令

    安装 yum install -y tree 使用,比如显示/root的2层树结构 tree -L 2 /root 效果 /root ├── \033 ├── code │   └── hellowo ...

  8. nginx限制连接

    limit_conn_zone $binary_remote_addr zone=addr:10m; locaton /download { limit_rate_after 128k; #是对每个连 ...

  9. C#前后端交互

    后台接收 方式1: Request.Form[""] post Request.QueryString[""] get System.Web.HttpConte ...

  10. python全栈开发从入门到放弃之元组的内置应用

    1.元组的字符类型tuple t=(1,[1,3],'sss',(1,2)) print(type(t)) <class 'tuple'> 2.按索引号取值 t=(1,[1,3],'sss ...