题目描述

A mod-dot product between two arrays with length n produce a new array with length n. If array A is a1,a2,...,an and array B is b1,b2,...bn, then A mod-dot B produce an array C c1,c2,...,cn such that c1 =  a1*b1%n, c2 = a2*b2%n,...,ci = ai*bi%n,..., cn = an*bn%n.
i.e. A = [2,3,4] and B = [5,2,2] then A mod-dot B = [1,0,2].
A permutation of n is an array with length n and every number from 0 to n-1 appears in the array by exactly one time.
i.e. A = [2,0,1] is a permutation of 3, and B = [3,4,1,2,0] is a permutation of 5, but C = [1,2,2,3] is NOT a permutation of 4.
Now comes the problem: Are there two permutaion of n such that their mod-dot product is also a permutation of n?

输入描述:

The only line with the number n (1 <= n <= 1000)

输出描述:

If there are such two permutation of n that their mod-dot product is also a permutation of n, print "Yes" (without the quote). Otherwise print "No" (without the quote).
示例1

输入

2

输出

Yes

说明

A = [0,1] and B = [0,1]. Then A mod-dot B = [0,1]
示例2

输入

997

输出

No

备注:

1 <= n <= 1000

题解

规律。

写了个暴力,算了$1$到$11$的答案,发现只有$1$和$2$有解,所以猜了一发。。

#include <cstdio>
#include <algorithm>
using namespace std; int main() {
int n;
scanf("%d", &n);
if(n == 1 || n == 2) printf("Yes\n");
else printf("No\n");
return 0;
}

  

湖南大学ACM程序设计新生杯大赛(同步赛)E - Permutation的更多相关文章

  1. 湖南大学ACM程序设计新生杯大赛(同步赛)J - Piglet treasure hunt Series 2

    题目描述 Once there was a pig, which was very fond of treasure hunting. One day, when it woke up, it fou ...

  2. 湖南大学ACM程序设计新生杯大赛(同步赛)A - Array

    题目描述 Given an array A with length n  a[1],a[2],...,a[n] where a[i] (1<=i<=n) is positive integ ...

  3. 湖南大学ACM程序设计新生杯大赛(同步赛)L - Liao Han

    题目描述 Small koala special love LiaoHan (of course is very handsome boys), one day she saw N (N<1e1 ...

  4. 湖南大学ACM程序设计新生杯大赛(同步赛)B - Build

    题目描述 In country  A, some roads are to be built to connect the cities.However, due to limited funds, ...

  5. 湖南大学ACM程序设计新生杯大赛(同步赛)I - Piglet treasure hunt Series 1

    题目描述 Once there was a pig, which was very fond of treasure hunting. The treasure hunt is risky, and ...

  6. 湖南大学ACM程序设计新生杯大赛(同步赛)D - Number

    题目描述 We define Shuaishuai-Number as a number which is the sum of a prime square(平方), prime cube(立方), ...

  7. 湖南大学ACM程序设计新生杯大赛(同步赛)H - Yuanyuan Long and His Ballons

    题目描述 Yuanyuan Long is a dragon like this picture?                                     I don’t know, ...

  8. 湖南大学ACM程序设计新生杯大赛(同步赛)G - The heap of socks

    题目描述 BSD is a lazy boy. He doesn't want to wash his socks, but he will have a data structure called ...

  9. 湖南大学ACM程序设计新生杯大赛(同步赛)C - Do you like Banana ?

    题目描述 Two endpoints of two line segments on a plane are given to determine whether the two segments a ...

随机推荐

  1. JS获取URL中参数值(QueryString)的4种方法分享

    方法一:正则法 function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(& ...

  2. 前端PHP入门-024-字符串函数-API查看

    数组.字符串和数据库是我们函数里面最.最.最常用的三类函数,数组和数据库我们现在还没有讲到,等讲到的时候我们再来和大家细说. 当然PHP的字符串函数也有很多.我们最常使用的两个系列的字符串: 单字节字 ...

  3. CF767 C.Garland DFS

    LINK 题意:给定一棵树,每个节点拥有权值,问能否找到两个点,断开它们与父节点的边能使树分成权值和相等的三部分.权值可以为负 思路:进行两遍DFS,第一遍找最深的子树和为sum/3的节点,标记掉找到 ...

  4. ZOJ 3776 A - Pokemon Master 签到水题

    link 求和比大小... /** @Date : 2017-03-23-21.26 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : http ...

  5. [转]C++中cin、cin.get()、cin.getline()、getline()函数的简单总结

    参考原文:http://www.cnblogs.com/flatfoosie/archive/2010/12/22/1914055.html,另外做了一些修改~ 1.cin 2.cin.get() 3 ...

  6. LOW逼三人组(一)----冒泡算法

    排序 1.冒泡排序 冒泡算法 import random # 随机模块 def bubble_sort(li): ###################################冒泡排序#### ...

  7. Django之动态验证码的生成

    kind.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  8. Go语言 2 变量、常量和数据类型

    文章由作者马志国在博客园的原创,若转载请于明显处标记出处:http://www.cnblogs.com/mazg/ Go学习群:415660935 2.1 变量 变量是对一块内存空间的命名,程序可以通 ...

  9. elk系列7之通过grok分析apache日志【转】

    preface 说道分析日志,我们知道的采集方式有2种: 通过grok在logstash的filter里面过滤匹配. logstash --> redis --> python(py脚本过 ...

  10. 详解Oracle的unlimited tablespace系统权限

    1. 系统权限unlimited tablespace是隐含在dba, resource角色中的一个系统权限. 当用户得到dba或resource的角色时, unlimited tablespace系 ...