解题报告8VC Venture Cup 2017 - Elimination Round
题目链接:http://codeforces.com/contest/755
本蒟蒻做了半天只会做前两道题。。
A. PolandBall and Hypothesis
题意:给出n,让你找出一个m,使n*m+1不是素数。
数据很小,直接暴力枚举。
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std ; bool prime( int n )
{
for( int i = 2 ; i <= sqrt(n) ; i++)
if( n % i == 0 )
return false;
return true;
} int main()
{
int n ;
cin >> n ;
for( int i = 1 ; i <= 1000 ; i++)
{
if( ! prime( n*i + 1 ) )
{
cout << i << endl ;
return 0 ; }
}
return 0 ;
}
第二题:
题意 :给出n,m 表示每个人拥有的单词数, 然后给出每个人的单词, 现在从第一个人开始每次说一个自己有单词, 不能出现重复的, 谁说不了了就输了。
第一次提交:
把 两个人重复的去掉之后比大小,若第一个人大于等于第二个人则YES,否则NO。
WA了。因为没考虑到
3 3
a
a
c
a
a
b
这种一样的会是偶数的情况。所以在去重之后要分奇偶
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
string a[1010] , b[1010];
int n , m ;
cin >> n >> m ;
for( int i = 1 ; i <= n ; i++)
cin >> a[i] ;
for( int i = 1 ; i <= m ; i++)
cin >> b[i] ;
int diff = 0 ;
for( int i = 1 ; i <= m ; i++)
{
for( int j = 1 ; j <= n ; j++)
{
if( b[i] == a[j] )
diff++;
}
} n = n - diff , m = m - diff ;
if( n > m )
cout << "YES" << endl;
else if ( n == m )
{
if( diff % 2 == 1 )
cout << "YES" <<endl;
else
cout <<"NO" << endl ;
}
else
cout << "NO"<<endl ;
return 0 ;
}
看到有人用map去重。STL还是不太会呢,MAP去重应该比我高好多,索性题目数据小。
第三题
题读了半天勉强读懂了,然而相关算法不知道是什么。。
解题报告8VC Venture Cup 2017 - Elimination Round的更多相关文章
- 8VC Venture Cup 2017 - Elimination Round
传送门:http://codeforces.com/contest/755 A题题意是给你一个数字n,让你找到一个数字m,使得n*m+1为合数,范围比较小,直接线性筛出1e6的质数,然后暴力枚举一下就 ...
- 8VC Venture Cup 2017 - Elimination Round - C
题目链接:http://codeforces.com/contest/755/problem/C 题意:PolandBall 生活在一个森林模型的环境中,定义森林由若干树组成,定义树为K个点,K-1条 ...
- 8VC Venture Cup 2017 - Elimination Round - B
题目链接:http://codeforces.com/contest/755/problem/B 题意:给定PolandBall 和EnemyBall 这2个人要说的单词,然后每一回合轮到的人要说一个 ...
- 8VC Venture Cup 2017 - Elimination Round - A
题目链接:http://codeforces.com/contest/755/problem/A 题意:给定一个正整数N,问你是否存在一个数M使得N*M+1不是素数(M的范围在[1,1000]). 思 ...
- Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition)A 水 B 二分 C并查集
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- 8VC Venture Cup 2016 - Elimination Round D. Jerry's Protest 暴力
D. Jerry's Protest 题目连接: http://www.codeforces.com/contest/626/problem/D Description Andrew and Jerr ...
- 8VC Venture Cup 2016 - Elimination Round
在家补补题 模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, in ...
- 8VC Venture Cup 2016 - Elimination Round (C. Block Towers)
题目链接:http://codeforces.com/contest/626/problem/C 题意就是给你n个分别拿着2的倍数积木的小朋友和m个分别拿着3的倍数积木的小朋友,每个小朋友拿着积木的数 ...
- codeforces 8VC Venture Cup 2016 - Elimination Round C. Lieges of Legendre
C. Lieges of Legendre 题意:给n,m表示有n个为2的倍数,m个为3的倍数:问这n+m个数不重复时的最大值 最小为多少? 数据:(0 ≤ n, m ≤ 1 000 000, n + ...
随机推荐
- apns关于APP数字角标的理解
前两天群里有兄弟在吐槽,做远程推送的时候:老板要求APP桌面图标的右上角显示红色未读数字(数字角标)要精准,有多少未读通知就显示数字几:但是后台的弟兄在发送推送通知的时候,每次的角标是1,然后要移动端 ...
- javascript 数组方法解析
测试数组:testArrayA = ['a','b','c','d','e'] , testArrayB = [2,3,6,1] 1.删除数组最后一项(pop()): 返回删除那一项的值:var po ...
- 【JS学习笔记】函数传参
比如仅仅改变背景的颜色 函数传参:参数就是占位符. 那么在什么时候用传参呢?函数里定不下来的东西. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1 ...
- kibana使用的lucene查询语法
kibana在ELK阵营中用来查询展示数据elasticsearch构建在Lucene之上,过滤器语法和Lucene相同 kibana4官方演示页面 全文搜索 在搜索栏输入login,会返回所有字段值 ...
- Imagine Cup 微软“创新杯”全球学生科技大赛
一. 介绍 微软创新杯微博:http://blog.sina.com.cn/u/1733906825 官方站点:https://www.microsoft.com/china/msdn/student ...
- mysql中You can't specify target table for update in FROM clause
使用mysql在删除表中重复记录 delete from user where username in (select user name form(select username from user ...
- ECMAScript6之Array类型的扩展
数组的扩展 Array.of() 将一组值转换成数组 Array.of(1,2,3,4,5); //[1,2,3,4,5] Array.from() 可将类似数组的对象或者可便利的对象转换成数组,比如 ...
- 记JavaScript的入门学习(二)
2016年11月25号,利用上午时间学习了JavaScript的数据类型和变量,下午就该去图书馆泡书了. 看完变量的本章节,发现我可能不能一天结束,那我就利用上午和晚上九点回来的时间完成吧.把心态调整 ...
- zabbix 布署实践【6 使用微信公众号-消息模版推送告警】
使用这个服务的前提是,你必须要有一个微信订阅号,或者公众号,并且是通过认证的号 因为认证过后的号才有模版消息和获取用户openid等信息的权限 ,如下,登录微信公众号的登录页后,底下有个接口权限的展示 ...
- PXE+kickstart自动安装ubuntu14.04
本文参考了诸多文章,先感谢这些文章的作者. 使用pxe安装系统需要安装dhcp,tftp,http等服务(当然也可以使用其他文件共享方式比如nfs,ftp). 实验环境: 1. vmware 12 2 ...