uva11827gcd
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的更多相关文章
随机推荐
- CMDB初步了解
本节内容 浅谈ITIL CMDB介绍 Django自定义用户认证 Restful 规范 资产管理功能开发 浅谈ITIL TIL即IT基础架构库(Information Technology Infra ...
- 基于vue + typescrpt +vuecli 搭建开发环境
打算学习typeScript与vue集成,先放几个链接,留着自己学习用,后续自己写使用新的~ https://segmentfault.com/a/1190000013676663 https://j ...
- 我的Android进阶之旅------>Android颜色值(#AARRGGBB)透明度百分比和十六进制对应关系以及计算方法
我的Android进阶之旅-->Android颜色值(RGB)所支持的四种常见形式 透明度百分比和十六进制对应关系表格 透明度 十六进制 100% FF 99% FC 98% FA 97% F7 ...
- DRF(3) - 序列化组件(GET/PUT/DELETE接口设计)、视图优化组件
一.序列化组件 基于上篇随笔的表结构,通过序列化组件的ModelSerializer设计如下三个接口: GET 127.0.0.1:8000/books/{id} # 获取一条数据,返回值:{} PU ...
- 3个Activity间的切换
package com.yarin.android.Examples_03_01; import android.app.Activity; import android.content.Intent ...
- linux内核打印级别
1.printk()是一个内核的一个记录日志的机制,经常用来记录信息或者警告.printk可以指定输出日志的优先级,在include/linux/kern_levels.h中有相应的宏定义 #defi ...
- 10046 trace详解(1)
10046 trace帮助我们解析一条/多条SQL.PL/SQL语句的运行状态,这些状态包括:Parse/Fetch/Execute三个阶段中遇到的等待事件.消耗的物理和逻辑读.CPU时间.执行计划等 ...
- LocalReport Print with C# C#打印RDLC
{ ; ) { ...
- PolyBase--整合SQLServer和Hadoop
我们一直强调,大数据和传统的关系数据库并不对立,未来公司的的业务将会是大数据和关系型数据库的整合.微软的PolyBase打响了SQL Server和Hadoop整合的第一枪. 在2012年度的SQL ...
- 登录用户执行sudo时报错
场景: 以普通用户登录,登陆后切换至root或其他用户时报错(sudo su -或sudo -i) 报错信息: -bash: /bin/logger: Argument list too long 根 ...