解题报告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 + ...
随机推荐
- kubernetes入门之kube-proxy实现原理
kube-proxy service是一组pod的服务抽象,相当于一组pod的LB,负责将请求分发给对应的pod.service会为这个LB提供一个IP,一般称为cluster IP. kube-pr ...
- anadonca环境配置和模块安装
1.最方便的python环境配置: 下载anaconda即可,自带spyder,集成科学计算的库,自带pip,不用折腾. 想用sublime编写python并运行的话,需要自己配置编译环境,并下载插件 ...
- 当我们在谈论kmeans(5)
本系列意在长期连载分享,内容上可能也会有所删改: 因此如果转载,请务必保留源地址,非常感谢! 博客园:http://www.cnblogs.com/data-miner/(暂时公式显示有问题) 其他: ...
- MVC源码解析 - Http Pipeline 解析(下)
接上一篇, 我在 HttpModule 的Init方法中, 添加了自己的事件, 在Pipeline里, 就会把握注册的事件给执行了. 那么Pipeline是如何执行并且按照什么顺序执行的呢? 现在我们 ...
- Day1-python理论基础
一.python介绍 Python 的创始人为Guido van Rossum.Guido为了打发圣诞节的无趣,于1989年发明,在荷兰国家数学和计算机科学研究所设计出来的(作为ABC 语言的一种继 ...
- React一些必须要知道的基础
React 起源于 Facebook 的内部项目,因为该公司对市场上所有 JavaScript MVC 框架,都不满意,就决定自己写一套,用来架设 Instagram 的网站.做出来以后,发现这套东西 ...
- 二、mongo数据库
官网:https://www.mongodb.com/ 进入官网 右上角有个下载按钮Download 1.完成安装后:运行--cmd(命令面板) 2.常用命令: 打开数据库 mongod –dbpat ...
- Redmine管理项目2-邮件通知
下面是为Redmine配置邮件通知 配置文件 config/configuration.yml 是 Redminde 的配置文件,里面有非常多的选项,邮件通知.附件保存地址. SCM .rmagick ...
- Linux下产生随机密码10方法
有特殊符号的: cat /dev/urandom | tr -dc "a-zA-Z0-9_+\~\!\@\#\$\%\^\&\*"| fold -w 16 |head -n ...
- sql的ExecuteScalar(),ExecuteNonQuery()
一,ExecuteScalar ExecuteScalar()也返回一个int型变量.如果SQL语句是Select查询,则仅仅返回查询结果集中第一行第一列,而忽略其他行和列.如果SQL语句不是Sele ...