Problem A. Alien Communication Masterclass

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/gym/100610

Description

Andrea is a famous science fiction writer, who runs masterclasses for her beloved readers. The most popular one is the Alien Communication Masterclass (ACM), where she teaches how to behave if you encounter alien life forms or at least alien artifacts. One of the lectures concerns retrieving useful information based on aliens’ writings. Andrea teaches that based on alien mathematical formulas, one could derive the base of the numeral system used by the aliens, which in turn might give some knowledge about aliens’ organisms. (For example, we use numeral system with base 10, due to the fact that we have ten fingers on our upper extremities). Suppose for simplicity that aliens use the same digits as we do, and they understand and denote addition, subtraction, multiplication, parentheses and equality the same way as we do. For her lecture, Andrea wants an example of a mathematical equality that holds in numeral systems with bases a1, a2, · · · , an, but doesn’t hold in numeral systems with bases b1, b2, · · · , bm. Provide her with one such formula.

Input

The first line of the input file contains two integer numbers, n and m (1 ≤ n, m ≤ 8). The second line contains n numbers, a1, a2, · · · , an. The third line contains m numbers, b1, b2, · · · , bm. All ai and bi are distinct and lie between 2 and 10, inclusive.

Output

Output any syntactically correct mathematical equality that holds in numeral systems with bases a1, a2, · · · , an, but doesn’t hold in numeral systems with bases b1, b2, · · · , bm. The equality can contain only digits 0 through 9, addition (‘+’), subtraction and unary negation (‘-’), multiplication (‘*’), parentheses (‘(’ and ‘)’) and equality sign (‘=’). There must be exactly one equality sign in the output. Any whitespace characters in the output file will be ignored. The number of non-whitespace characters in the output file must not exceed 10 000.

Sample Input

1 2 2 3 9

Sample Output

(10 - 1) * (10 - 1) + 1 = 10

HINT

 

题意

要求你输出等式,满足N种进制,但是不满足任何的M种进制

题解:

直接输出(10-a1*1)*(10-a2*1)*……*(10-an*1)=0就好了

只有在n种进制中才能满足条件

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <bitset>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 110000
#define mod 1001
#define eps 1e-9
#define pi 3.1415926
int Num;
//const int inf=0x7fffffff; //§ß§é§à§é¨f§³
const ll inf=;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************* //(k-a1)(k-a2)(k-a3)*.....*(k-an) int a[];
int b[];
int main()
{
freopen("acm.in","r",stdin);
freopen("acm.out","w",stdout);
int n=read(),m=read();
for(int i=;i<n;i++)
cin>>a[i];
for(int i=;i<m;i++)
cin>>b[i];
for(int i=;i<n;i++)
{
cout<<"(10-";
for(int j=;j<=a[i];j++)
{
if(j!=a[i])
cout<<"1-";
else
cout<<"";
}
if(i!=n-)
cout<<")*";
else
cout<<")";
}
cout<<"=0";
}

Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造的更多相关文章

  1. Codeforces Gym 100610 Problem K. Kitchen Robot 状压DP

    Problem K. Kitchen Robot Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10061 ...

  2. Codeforces Gym 100610 Problem H. Horrible Truth 瞎搞

    Problem H. Horrible Truth Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1006 ...

  3. Codeforces Gym 100610 Problem E. Explicit Formula 水题

    Problem E. Explicit Formula Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  4. 【Gym 100610A】Alien Communication Masterclass

    题 Andrea is a famous science fiction writer, who runs masterclasses for her beloved readers. The mos ...

  5. Codeforces Gym 100342J Problem J. Triatrip 求三元环的数量 bitset

    Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...

  6. Codeforces Gym 100342C Problem C. Painting Cottages 转化题意

    Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  7. Codeforces Gym 100342C Problem C. Painting Cottages 暴力

    Problem C. Painting CottagesTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1 ...

  8. Codeforces Gym 100500F Problem F. Door Lock 二分

    Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...

  9. Codeforces Gym 100002 Problem F "Folding" 区间DP

    Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...

随机推荐

  1. BasicDataSource配备

    BasicDataSource配置 commons DBCP 配置参数简要说明 前段时间因为项目原因,要在修改数据库连接池到DBCP上,折腾了半天,有一点收获,不敢藏私,特在这里与朋友们共享. 在配置 ...

  2. Winfrom 开发系统导航菜单

    先上图看效果在说. 效果图如上,在Web中这个一点难度都没有,几行Css+JS就搞定了.但是在Winfrom中.本来就是半杯水的水准,想做这个个导航菜单,发现真难找,找了很多都不合胃口,只能自己写个了 ...

  3. 【转】STL空间配置器

    STL空间配置器(allocator)在所有容器内部默默工作,负责空间的配置和回收.STL标准为空间配置器定义了标准接口(可见<STL源码剖析>P43).而具体实现细节则由各编译器实现版本 ...

  4. ylbtech-SubwayNav(地铁线路导航)-数据库设计

    ylbtech-DatabaseDesgin:ylbtech-SubwayNav(地铁线路导航)-数据库设计 DatabaseName:SubwayNav(地铁线路导航) Type:线路导航 1.A, ...

  5. HDU5731 Solid Dominoes Tilings 状压dp+状压容斥

    题意:给定n,m的矩阵,就是求稳定的骨牌完美覆盖,也就是相邻的两行或者两列都至少有一个骨牌 分析:第一步: 如果是单单求骨牌完美覆盖,请先去学基础的插头dp(其实也是基础的状压dp)骨牌覆盖 hiho ...

  6. A Blind Watermarking for 3-D Dynamic Mesh Model Using Distribution of Temporal Wavelet Coefficients

    这周看了一篇动态网格序列水印的论文,由于目前在网格序列上做水印的工作特别少,加之我所看的这篇论文中的叙述相对简洁,理解起来颇为困难.好在请教了博士师兄,思路明朗了许多,也就把这思路整理在此了. 论文作 ...

  7. 给MyEclipse 10增加SVN功能

    1.在myeclipse的安装目录下 myeclipse 10文件夹下的 dropins文件夹新建一个文件夹 svn. 2.然后下载SVN插件:svn插件网站:http://subclipse.tig ...

  8. Xcode 6 越狱开发基础

    最近接触到XCode越狱开发的问题,越狱开发首先iphone设备得越狱,然后安装Appsync,安装之后,安装ipa将不再验证程序签名的有效性,不签名的程序也可以直接在设备上运行,只需要保证IPA本身 ...

  9. [转]sublime 使用技巧总结

    原文链接:http://www.cnblogs.com/yingzi/archive/2012/04/24/2469056.html 对于用惯了editplus的人来说,突然接触到sublime有点无 ...

  10. linux内核地址mapping

    linux内核采用页式存储管理,虚拟地址空间划分成固定大小的页面,由MMU(memory manager unit)在运行时将virtual address mapping to (或者说是变化成)某 ...