当前位置:网站首页>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;
}
边栏推荐
- "Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
- 创建格式化时间,格式化时区的gson对象。json解析时间格式化 ZonedDateTime
- Speech enhancement - spectrum mapping
- Causes of wechat applet compilation page blank bug
- Compilation principles final review
- Linked list (I) - remove linked list elements
- Pytorch RNN learning notes
- Error reporting - resolve core JS / modules / es error. cause. JS error
- [C#][转载]furion框架地址和教程地址
- 代码没写错,渲染页面不显示原因
猜你喜欢
随机推荐
From the beginning of redis learning to take-off, this article is all for you
What if the applet page is set to 100% height or left blank?
Introduction to browser tools: think sky browser, team work browser
[interval DP] stone consolidation
整型提升和大小端字节序
[digital statistics DP] counting problem
编译原理期末复习
未来互联网人才还稀缺吗?哪些技术方向热门?
图片按日期批量导入WPS表格
Linked list (I) - remove linked list elements
Extern "C" overview
Deleting MySQL under Linux
Compilation principles final review
Comprehensive analysis of real enterprise software testing process
Recommend 10 popular jupyter notebook plug-ins to make you fly efficiently
整型提昇和大小端字節序
Linked list (III) - reverse linked list
什么是一致性哈希?可以应用在哪些场景?
JDBC learning (I) -- implementing simple CRUD operations
[C#][转载]furion框架地址和教程地址








