当前位置:网站首页>7-1 懂的都懂 (20 分)
7-1 懂的都懂 (20 分)
2022-07-06 09:25:00 【是小张张呀 zsy】
2021 RoboCom 世界机器人开发者大赛-本科组(初赛)
7-1 懂的都懂 (20 分)
众所周知,在互联网上有很多话是不好直接说出来的,不过一些模糊的图片仍然能让网友看懂你在说什么。然而对这种言论依然一定要出重拳,所以请你实现一个简单的匹配算法。
现在我们采集了原图的一些特征数据,由 N 个小于 255 的非负整数组成,假设对于给定的若干张由 M个同样小于 255 的非负整数组成的新图的特征数据,每个数据都可以由原图中任意四个不同数据的平均值计算而来,则称新图为原图的相似图片。对于给出的数据,请你判断是不是相似图片。
注意,不同数据指的并非是数据的值不同,而是不能取同一个数据多次。对于两个相同值的数据,如果给出两次,则可以取两次。
输入格式:
输入第一行是两个整数 N,K (1 ≤ N ≤ 50, 1 ≤ K ≤ 200),表示采集的原图的特征数据个数和新图的张数。
接下来一行为 N 个小于 255 的非负整数,表示原图的特征数据。
最后的 K 行,每行第一个数是 M 表示新图的特征数据个数。然后是 M 个小于 255 的非负整数,表示新图的特征数据。
输出格式:
对于每一张新图,如果为相似图片,则在一行中输出 Yes,否则输出 No。
输入样例:
5 3
4 8 12 20 40
3 11 16 19
3 12 16 19
10 11 11 11 11 11 11 11 11 11 11
输出样例:
Yes
No
Yes
#include <bits/stdc++.h>
using namespace std;
double a[8000000],b[205],c[205];
int main(){
int m,n;
cin>>m>>n;
for(int i=0;i<m;i++){
cin>>b[i];
}
int kk=0;
for(int i=0;i<m;i++){
for(int j=i+1;j<m;j++){
for(int k=j+1;k<m;k++){
for(int h=k+1;h<m;h++){
a[kk++]=b[i]+b[j]+b[k]+b[h];
}
}
}
}
sort(a,a+kk);
while(n--){
int ss;
cin>>ss;
for(int i=0;i<ss;i++){
cin>>c[i];
}
int oo=0;
for(int i=0;i<ss;i++){
int h=lower_bound(a,a+kk,c[i]*4.0)-a;
if(a[h]!=c[i]*4.0){
oo=1;
break;
}
}
if(oo==1)
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;
}
return 0;
}
边栏推荐
- 动态规划前路径问题
- 学习记录:如何进行PWM 输出
- C4D quick start tutorial - creating models
- Crawling cat's eye movie review, data visualization analysis source code operation instructions
- Market trend report, technical innovation and market forecast of geosynthetic clay liner in China
- China's earthwork equipment market trend report, technical dynamic innovation and market forecast
- Scoring system based on 485 bus
- Medical colposcope Industry Research Report - market status analysis and development prospect forecast
- Optimization method of path problem before dynamic planning
- Intensive learning notes: Sutton book Chapter III exercise explanation (ex17~ex29)
猜你喜欢

C4D quick start tutorial - creating models

学习记录:TIM—电容按键检测

Interface test interview questions and reference answers, easy to grasp the interviewer

学习记录:STM32F103 时钟系统概述工作原理

Crawling cat's eye movie review, data visualization analysis source code operation instructions

Stm32 dossiers d'apprentissage: saisie des applications
![[C language] twenty two steps to understand the function stack frame (pressing the stack, passing parameters, returning, bouncing the stack)](/img/3a/aadde60352c42199ba287a6997acfa.jpg)
[C language] twenty two steps to understand the function stack frame (pressing the stack, passing parameters, returning, bouncing the stack)

STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)

Learning records: serial communication and solutions to errors encountered

用C语言写网页游戏
随机推荐
TCP的三次握手与四次挥手
Cost accounting [13]
Interface test interview questions and reference answers, easy to grasp the interviewer
LeetCode#412. Fizz Buzz
Cost accounting [16]
ucorelab4
China earth moving machinery market trend report, technical dynamic innovation and market forecast
通俗地理解什么是编程语言
Cost accounting [18]
学习记录:如何进行PWM 输出
Hospital privacy screen Industry Research Report - market status analysis and development prospect forecast
CSAPP shell lab experiment report
STM32学习记录:输入捕获应用
Cost accounting [13]
The wechat red envelope cover designed by the object is free! 16888
LeetCode#204. Count prime
ucore lab 2
Automated testing problems you must understand, boutique summary
Market trend report, technical innovation and market forecast of geosynthetic clay liner in China
ucore Lab 1 系统软件启动过程