题目链接: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的更多相关文章

  1. 8VC Venture Cup 2017 - Elimination Round

    传送门:http://codeforces.com/contest/755 A题题意是给你一个数字n,让你找到一个数字m,使得n*m+1为合数,范围比较小,直接线性筛出1e6的质数,然后暴力枚举一下就 ...

  2. 8VC Venture Cup 2017 - Elimination Round - C

    题目链接:http://codeforces.com/contest/755/problem/C 题意:PolandBall 生活在一个森林模型的环境中,定义森林由若干树组成,定义树为K个点,K-1条 ...

  3. 8VC Venture Cup 2017 - Elimination Round - B

    题目链接:http://codeforces.com/contest/755/problem/B 题意:给定PolandBall 和EnemyBall 这2个人要说的单词,然后每一回合轮到的人要说一个 ...

  4. 8VC Venture Cup 2017 - Elimination Round - A

    题目链接:http://codeforces.com/contest/755/problem/A 题意:给定一个正整数N,问你是否存在一个数M使得N*M+1不是素数(M的范围在[1,1000]). 思 ...

  5. 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 ...

  6. 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 ...

  7. 8VC Venture Cup 2016 - Elimination Round

    在家补补题   模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, in ...

  8. 8VC Venture Cup 2016 - Elimination Round (C. Block Towers)

    题目链接:http://codeforces.com/contest/626/problem/C 题意就是给你n个分别拿着2的倍数积木的小朋友和m个分别拿着3的倍数积木的小朋友,每个小朋友拿着积木的数 ...

  9. 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 + ...

随机推荐

  1. Wget 命令详解

    Wget主要用于下载文件,在安装软件时会经常用到,以下对wget做简单说明. 1.下载单个文件:wget http://www.baidu.com.命令会直接在当前目录下载一个index.html的文 ...

  2. Linux下安装zookeeper集群

    首先,准备三台Linux虚拟机 三台机器 centos01 :192.168.1.168(lxs001)   centos03 :192.168.1.178(lxs003)   centos03 :1 ...

  3. html&css入门详解

    本系列主要讲解html与css的知识点,因为是参考的英文版的<html&css design and build websites>,所以可能会有个人翻译理解上的差错,希望观者能够 ...

  4. Float 的那些事

    css float 定义元素浮动到左侧或者右侧.其出现的本意是让文字环绕图片而已. left.right.inherit(从父级元素获取float值).none 一.浮动的性质 1. 包裹性 disp ...

  5. 新mac上安装,查看,设置一些常用的软件

    安装 brew install ~ 查看相关信息 brew info ~ 设置登录自启动 brew services start ~(本质是在~/Library/LaunchAgents/下面加了对应 ...

  6. .Net异步函数存在的限制

    本文摘录自CLR Via C# 第四版. 异步函数存在以下限制: 1.不能讲应用程序的Main方法转变成异步函数.另外,构造器.属性访问器方法和时间访问器方法不能转变成异步函数. 2.异步函数不能使用 ...

  7. Ubuntu中Qt新建窗体提示lGL错误

    提示错误: cannot find -lGL collect2:error:ld returned 1 exit status 这是因为系统缺少链接库,终端输入: sudo apt-get insta ...

  8. CSS3之响应式布局

    在没有C3的时候,响应式布局是通过js来实现的. 开始研究响应式web设计,CSS3 Media Queries是入门. Media Queries,其作用就是允许添加表达式用以确定媒体的环境情况,以 ...

  9. matcaffe的blob维度顺序

    matcaffe是caffe的matlab接口.caffe本身是C++写的,其blob的维度顺序是[N,C,H,W],N表示batchSize,C表示channel数目,H表示feature map的 ...

  10. CodeForces 706C Hard problem

    简单$dp$. $dp[i][0]$:第$i$个串放置完毕,并且第$i$个串不反转,前$i$个串字典序呈非递减的状态下的最小费用. $dp[i][1]$:第$i$个串放置完毕,并且第$i$个串反转,前 ...