题目描述

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. Android Studio Gradle's dependency cache may be corrupt Re-download dependencies and sync project (requires network)

    转:Android studio 快速解决Gradle's dependency cache may be corrupt 和 Gradle配置 gradle-3.*-all.zip快速下载 Andr ...

  2. codevs 2488 绿豆蛙的归宿

    2488 绿豆蛙的归宿 http://codevs.cn/problem/2488/  时间限制: 1 s  空间限制: 64000 KB  题目等级 : 黄金 Gold   题目描述 Descrip ...

  3. Elasticsearch Java API 查询

    一.查询的时候,需要建立一个SearchRequestBuilder,这里面将给出对于哪一个index或者type进行查询,并且所有的设置都可以在这里面进行实现,例如模糊查询,范围查询,前缀查询等. ...

  4. PHP与Ajax

    如何用PHP接收JSON格式数据 1.一般来说,我们直接用$_POST $_REQUEST $_GET这样的超全局变量接收就好了 <?php $obj_temp=$_POST['data']; ...

  5. 【BZOJ】4318: OSU! 期望DP

    [题意]有一个长度为n的01序列,每一段极大的连续1的价值是L^3(长度L).现在给定n个实数表示该位为1的概率,求期望总价值.n<=10^5. [算法]期望DP [题解]后缀长度是一个很关键的 ...

  6. https://segmentfault.com/bookmark/1230000008276077

    https://segmentfault.com/bookmark/1230000008276077

  7. NYOJ 35 表达式求值 (字符串处理)

    题目链接 描述 ACM队的mdd想做一个计算器,但是,他要做的不仅仅是一计算一个A+B的计算器,他想实现随便输入一个表达式都能求出它的值的计算器,现在请你帮助他来实现这个计算器吧. 比如输入:&quo ...

  8. docker使用现有容器生成新的镜像

    /*运行docker run后 --则进入该容器里了 我们做一些变更,比如安装一些东西 ,然后针对这个容器进行创建新的镜像 */ 基本形式: docker commit -m "change ...

  9. WordPress浏览数插件的安装使用

    插件安装很容易,但是和大多插件都一样,安装后需要调用代码才能显示,我安装后,也调用了.但是就是不显示,后来才发现,我从其他地方复制过来的代码,函数是中文的单引号,这样致使函数失效,注意代码中参数的引号 ...

  10. document.write 简介

    document.write 的执行分两种情况: 第一种:dom加载已完成 1. 执行 document.open() (即会清空document) 2. 执行 document.write() 3. ...