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. Java IO异常处理方式

    public class IOException{ // 获取系统默认的行分隔符 private static final String LINE_SEPARATOR = System.getProp ...

  2. String trim 坑 对于ascii码为160的去不掉

    大家在使用string   的trim去除空格的时候,要注意一个坑呀,对于ascii码为160的去不掉 import java.util.Arrays; /** * Created by bjchen ...

  3. shell脚本杂

    1.sh -x 跟踪shell脚本中的每个命令 [root@master shellexer]# cat bash.sh #!/bin/bash var=$ echo $var [root@maste ...

  4. python用whl文件安装包

    直接用pip安装包的时候有时会因为许多奇怪的原因安装失败,这时就需要祭出大杀器——whl文件 python3 -m pip install whl文件路径名 whl库:https://www.lfd. ...

  5. 我的Android进阶之旅------>解决:debug-stripped.ap_' specified for property 'resourceFile' does not exist.

    1.错误描述 更新Android Studio到2.0版本后,出现了编译失败的问题,我clean project然后重新编译还是出现抑郁的问题,问题具体描述如下所示: Error:A problem ...

  6. 谷歌公布全新设计语言:跟苹果Swift天差地别

    今日凌晨.谷歌(微博)在I/O大会上公布了全新设计语言Material Design.在20多天前的WWDC上.苹果也公布了全新编程语言Swift.两家科技巨头公司,在一年一度的开发人员大会上,都公布 ...

  7. python删除所有的中文字符、非ASCII或非英文字符,检查字符串是否包含非ASCII

    Your ''.join() expression is filtering, removing anything non-ASCII; you could use a conditional exp ...

  8. Appium做Android功能自动化测试

    前言 做Android端功能自动化已有2年多的时间了,使用过的功能自动化框架有Robotium.Uiautomator.Appium.最近研究自动化case复用的方案,调研了Appium的自动化框架, ...

  9. iOS学习之应用偏好设置

    如今,即便是最简单的计算机程序也会包含一个偏好设置窗口,用户可以在其中设置应用专属的选项.在MAC OS X中,Preferences...菜单通常位于应用菜单中.选择该菜单项会弹出一个窗口,用户可以 ...

  10. python16_day15【Django入门】

    一.Django基本 1.什么是框架 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你用别人搭建好的舞台来做表 ...