当前位置:网站首页>7-1 懂的都懂
7-1 懂的都懂
2022-06-28 07:00:00 【wow_awsl_qwq】
7-1 懂的都懂
分数 20
作者 DAI, Longao
单位 杭州百腾教育科技有限公司
b3ceb051352ac65c29767cc3ecf2b21192138add.jpg
众所周知,在互联网上有很多话是不好直接说出来的,不过一些模糊的图片仍然能让网友看懂你在说什么。然而对这种言论依然一定要出重拳,所以请你实现一个简单的匹配算法。
现在我们采集了原图的一些特征数据,由 N 个小于 255 的非负整数组成,假设对于给定的若干张由 M
i
个同样小于 255 的非负整数组成的新图的特征数据,每个数据都可以由原图中任意四个不同数据的平均值计算而来,则称新图为原图的相似图片。对于给出的数据,请你判断是不是相似图片。
注意,不同数据指的并非是数据的值不同,而是不能取同一个数据多次。对于两个相同值的数据,如果给出两次,则可以取两次。
输入格式:
输入第一行是两个整数 N,K (1 ≤ N ≤ 50, 1 ≤ K ≤ 200),表示采集的原图的特征数据个数和新图的张数。
接下来一行为 N 个小于 255 的非负整数,表示原图的特征数据。
最后的 K 行,每行第一个数是 M
i
(1 ≤ M
i
≤ 200),表示新图的特征数据个数。然后是 M
i
个小于 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;
int a[100],b[4];
bool st[1200];
int n,k;
void dfs(int t,int x)
{
if(t==4)
{
int s=0;
for(int i=0;i<4;++i)s+=b[i];
//s/=4;
st[s]=true;
return ;
}
for(int i=x;i<n;++i){
b[t]=a[i];
dfs(t+1,i+1);
}
}
int main()
{
cin>>n>>k;
for(int i=0;i<n;++i)cin>>a[i];
dfs(0,0);
while(k--)
{
int t;cin>>t;
bool flag=true;
for(int i=0;i<t;++i)
{
int x;cin>>x;
x*=4;
if(st[x]==false){
flag=false;
}
}
if(flag)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
边栏推荐
- Introduction to browser tools: think sky browser, team work browser
- Linked list (I) - remove linked list elements
- Reinforcement learning - grid world
- 文件头信息对照表
- Server body 18: understanding and thinking of UDP reliable transmission (feeling from reading Yunfeng blog)
- Comprehensive analysis of real enterprise software testing process
- Libuv framework echo server C source code explanation (TCP part)
- 什么是一致性哈希?可以应用在哪些场景?
- 我的MVVM开源项目《出行防疫App》已发布
- 金山云团队分享 | 5000字读懂Presto如何与Alluxio搭配
猜你喜欢

Techo day Tencent technology open day, June 28 online waiting for you!

What is a consistent hash? What scenarios can it be applied to?

RN7302三相电量检测(基于STM32单片机)
Face to face experience --- test engineer web side automation --- interview questions for large factories

Yesterday, I went to a large factory for an interview and asked me to do four arithmetic operations. Fortunately, I am smart enough

Libuv框架echo-server.c源码详解(TCP部分)

Introduction to Qualcomm platform WiFi -- Wi Fi display software

整型提升和大小端字节序

Floating and positioning

A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages
随机推荐
FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO
4~20mA输入/0~5V输出的I/V转换电路
@RequestParam
代码没写错,渲染页面不显示原因
Libuv framework echo server C source code explanation (TCP part)
Pfizer's new Guankou medicine has entered the Chinese market, and the listing of relevant products of domestic pharmaceutical enterprises is just around the corner
推荐几款0代码、免费、现学现用的可视化工具
FPM tool installation
Trie string statistics
VM332 WAService. js:2 Error: _ vm. Changetabs is not a function
File header information cross reference table
Freeswitch uses origin to dialplan
【Rust日报】2020-05-24 Rash, Rocket, Mun, Casbin
面经---测试工程师web端自动化---大厂面试题
What if the applet page is set to 100% height or left blank?
浮动与定位
Will Internet talents be scarce in the future? Which technology directions are popular?
炒股开户在手机上安全吗?
CRC32概述以及实现和使用
Boost the rising point | yolov5 combined with alpha IOU