题目链接: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. mysql提示Column count doesn't match value count at row 1错误

    mysql提示Column count doesn't match value count at row 1错误,后来发现是由于写的SQL语句里列的数目和后面的值的数目不一致, 比如insert in ...

  2. WPF星空效果

    效果 前阵子看到ay的蜘蛛网效果和知乎的登录页背景,觉得效果很酷.自己也想写一个.于是写着写着就变成这样了.少女梦幻的赶脚有木有.我这有着一颗少女心的抠脚大汉 实现思路 分为两个部分: 1.星星无休止 ...

  3. C语言之循环结构 for(一)

    一 for循环的介绍 语法: for(表达式1;表达式2;表达式3){ 循环体; } 循环步骤: A.执行表达式1,执行完毕跳转到B B.判断表达式2的结果是否为真,如果为真,跳转到C,否则跳转到E ...

  4. Python json解析

    #encoding: utf-8 ''' Author:Siukwan ''' import sys reload(sys) sys.setdefaultencoding('utf8') import ...

  5. 360回归A股,周鸿祎来给BAT和小米添堵了

    排着队回国内上市的公司名单里,终于多了奇虎360的名字. 奇虎360今天宣布,公司董事会收到了来自董事长周鸿祎.中信证券及其附属公司.Golden Brick Capital Private Equi ...

  6. 仅以一个前端开发人员的角度看微信小程序

    看了几天的小程序(当然也包括了上手书写),才有了这篇博文,非技术贴,只是发表下个人观点,仅以个人技术能力来看小程序. 首先说下优点: 调试工具:官方的工具还是做了很多工作,包括监听文件变动自动刷新,编 ...

  7. angular-ui-bootstrap插件API - Tabs

    Tabs 案例 <!DOCTYPE html> <html lang="en" ng-app="myApp"> <head> ...

  8. 关于_cmd

    实际上是该方法名(@selector的名称). 比如: - (void)someCategoryMethod { NSString *string = objc_getAssociatedObject ...

  9. PHP基础语法思维导图

  10. CodeForces 669D Little Artem and Dance

    模拟. 每个奇数走的步长都是一样的,每个偶数走的步长也是一样的. 记$num1$表示奇数走的步数,$num2$表示偶数走的步数.每次操作更新一下$num1$,$num2$.最后输出. #pragma ...