G - Reduced ID Numbers(第二季水)
Description
Input
Output
Sample Input
2
1
124866
3
124866
111111
987651
Sample Output
1
8
没看懂题意 该题是求 各组数据取余不同 的最小数字
#include<iostream>
using namespace std;
int cmp ( const void *a , const void *b )
{
return *(int *)a - *(int *)b;
}
void f(int s[],int n)
{
int k,t,a[];
bool flag;
for(t=;;t++){
flag=true;
for(int i=;i<n;i++){
a[i]=s[i]%t;
}
qsort(a,n,sizeof(a[]),cmp);
for(int i=;i<n-;i++)
if(a[i]==a[i+]){
flag=false;
break;
}
if(flag==true)break;
}
cout<<t<<endl;
}
int main()
{
int n;
cin>>n;
while(n--){
int g,s[];
cin>>g;
for(int i=;i<g;i++)cin>>s[i];
if(g==)cout<<<<endl;
else f(s,g);
}
//system("pause");
return ;
}
G - Reduced ID Numbers(第二季水)的更多相关文章
- B - Maya Calendar(第二季水)
Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...
- L - 辗转相除法(第二季水)
Description The least common multiple (LCM) of a set of positive integers is the smallest positive i ...
- poj 2769 Reduced ID Numbers(memset使用技巧)
Description T. Chur teaches various groups of students at university U. Every U-student has a unique ...
- C - Reduced ID Numbers 寒假训练
T. Chur teaches various groups of students at university U. Every U-student has a unique Student Ide ...
- Y - Design T-Shirt(第二季水)
Description Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA ...
- F - The Fun Number System(第二季水)
Description In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight o ...
- D - Counterfeit Dollar(第二季水)
Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...
- S - 骨牌铺方格(第二季水)
Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种, ...
- R - 一只小蜜蜂...(第二季水)
Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. ...
随机推荐
- 【面向代码】学习 Deep Learning(三)Convolution Neural Network(CNN)
========================================================================================== 最近一直在看Dee ...
- 段的创建表user_segments
1.段的定义及类型 Oracle中的段(segment)是占用磁盘空间的一个对象,最常见的段类型包括: l 聚簇cluster l 表table l 表分区 tablepartition l ...
- WordPress插件制作教程概述
接下来的一段时间里,开始为大家讲解WordPress插件制作系列教程,这篇主要是对WordPress插件的一些介绍和说明,还有一些我们需要注意的地方,以及需要掌握的知识. WordPress插件允许你 ...
- php __FILE__,__CLASS__等魔术变量,及实例
今天突然看到几个自己不认识的魔术变量 不知道怎么用于是就上网查了一下,看到了这篇博客,写的真不错,希望自己以后也能学会这样总结 张映 发表于 2010-12-13 分类目录: php 标签:php, ...
- IOS开发UI篇-NavigationController的控制器之间的跳转
一.效果图如下 1> 第一个控制器的NavigationBar隐藏 2> 有按钮,可以跳转到下一个控制器,返回上一个控制器或者根控制器 二.思路代码 思路: 1> 设置window的 ...
- C#透过PerformanceCounter取得特定Process的CPU使用率
- VS2008远程调试方法
在网上找了好多资料才把这个调试环境搭好,下面总结一下: 先说明两个概念: 1. 目标机:远程需要调试的机子,也就是被调试程序exe所在的机子,该机子可以安装VS2008或者不安装vs2008 ...
- codecomb 2092【课程选择】
题目描述 大学选课总是烦恼着很多人.现在X同学选出了很多备选课,但是有的课程之间是有时间冲突的.X不会分身,自然无法在同一个时间上不同的课.每个课可能有很多备选时间,但是每个课只需要选一个时间上就可以 ...
- hdu 5493 Queue(线段树)
Problem Description N people numbered to N are waiting in a bank for service. They all stand in a qu ...
- 怎么查看chrome网络日志
最近在分析一个页面访问慢的问题,在分析的除了wireshark抓包等手段外,还用到了chrome的日志辅助分析 使用 chrome://net-internals/#events 可以打开日志追踪窗口 ...