当前位置: 首页 > news >正文

wordpress同步到本地外贸网站seo教程

wordpress同步到本地,外贸网站seo教程,手机网站大全12345,网站建设 java水题。题目大意为输入一个p,n,再输入n组数据,每组数据对p取余,当和前面相同时,发现冲突,记下第几组,找到最后一组没有找到和前面一样的输出-1。 *可以采用一个标记数组,就变得很简单了。 A. DZ…

水题。题目大意为输入一个p,n,再输入n组数据,每组数据对p取余,当和前面相同时,发现冲突,记下第几组,找到最后一组没有找到和前面一样的输出-1。

*可以采用一个标记数组,就变得很简单了。

A. DZY Loves Hash
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash function. In this problem we will assume, that h(x) = x mod p. Operation a mod b denotes taking a remainder after division a by b.

However, each bucket can contain no more than one element. If DZY wants to insert an number into a bucket which is already filled, we say a "conflict" happens. Suppose the first conflict happens right after the i-th insertion, you should output i. If no conflict happens, just output -1.

Input

The first line contains two integers, p and n (2 ≤ p, n ≤ 300). Then n lines follow. The i-th of them contains an integer xi (0 ≤ xi ≤ 109).

Output

Output a single integer — the answer to the problem.

Sample test(s)
input
10 5
0
21
53
41
53
output
4
input
5 5
0
1
2
3
4
output
-1
#include<stdio.h>
#include<string.h>
int main()
{int p,n;while(scanf("%d%d",&p,&n)!=EOF){int i;int x[305];int t;int tag=1;int temp;int w[304];//标记数组memset(w,0,sizeof(w));for(i=0;i<n;i++)scanf("%d",&x[i]);for(i=0;i<n;i++){t=x[i]%p;if(w[t]==0)w[t]=1;//进行标记else{tag=0;temp=i;break;}}if(tag==0)printf("%d\n",temp+1);elseprintf("-1\n");}return 0;
}



http://www.lbrq.cn/news/2650177.html

相关文章:

  • 如何完整保存网站并做修改一般网站推广要多少钱
  • 网站蜘蛛屏蔽怎样恢复数据分析网站
  • 商丘网站建设的公司哪家好文案写作软件app
  • 专业集团门户网站建设线上推广平台都有哪些
  • 青龙县建设局网站信阳seo推广
  • 杭州手机网站建设公司 网络服务媒体发稿公司
  • 石家庄做网站公司的电话网站推广该怎么做
  • 做私活 网站百度健康人工客服电话24小时
  • 舟山建设银行纪念币预约网站免费招聘信息发布平台
  • 网站程序代码优化引流软件有哪些
  • seo做的最好的网站排行朝阳网站建设
  • 网站推广营销应该怎么做seo免费系统
  • 用eclipse做jsp网站东莞seo排名收费
  • 顺德网站建设要多少钱baidu百度首页官网
  • 西安最好的网站建设公司我想做个网站怎么做
  • dede 中英文网站站长seo综合查询
  • 建网站要钱吗 优帮云自制网站
  • 毕设网站代做一般预算多少钱推广关键词如何优化
  • 有哪些手机网站十大接单推广平台
  • wordpress防止垃圾邮件方法aso搜索优化
  • 官网苹果手机14重庆百度整站优化
  • 鸿运网站建设搜索引擎最佳化
  • 网页怎么绑定wordpress北京seo产品
  • 网站的建设不包括什么福州网站快速排名提升
  • nba网站建设软文写作技巧及范文
  • 在线做热图的网站网站免费推广网站
  • 网站图片导入wordpress腾讯疫情实时数据
  • 太原网站域名开发福建百度推广开户
  • wordpress 外贸网站建设填写电话的广告
  • 如何制作一个软件app抖音关键词排名优化软件
  • 蓝牙技术概览
  • Autosar AP功能组状态和模型进程是否预定义后不改变了?
  • 2025最新版天猫图片搜索API全解析:从图像识别到商品匹配实战
  • E频段无线射频链路为5G网络提供高容量回程解决方案 — 第一部分
  • 哈勃网络计划大规模升级卫星以创建全球蓝牙层
  • 【网络编程】IO多路转接——select