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.

Examples

  

acm.in

acm.out

1 2    

2

3 9

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

2 2     

9 10

2 3

2 + 2 = 4

  

题意:给出a个数和b个数,求一个满足a1,a2,...进制不满足b1,b2,...进制的式子

分析:(a1-1-1-1-....)*(a2-1-1-...)...(an-1-1-...)=0即可满足条件,这题难就难在想的到不到这种式子了。

#include<stdio.h>
int n,m,a[],b;
int main(){
freopen("acm.in","r",stdin);
freopen("acm.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=;i<n;i++)
scanf("%d",&a[i]);
for(int i=;i<m;i++)
scanf("%d",&b);
for(int i=;i<n;i++){
printf("(10");
for(int j=;j<a[i];j++)
printf("-1");
printf(")");
if(i<n-) printf("*");
}
printf("=0\n");
return ;
}

  

【Gym 100610A】Alien Communication Masterclass的更多相关文章

  1. Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造

    Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codefo ...

  2. 【 Gym 101116K 】Mixing Bowls(dfs)

    BUPT2017 wintertraining(15) #4H Gym - 101116K 题意 给定一个菜谱,大写的单词代表混合物,小写的代表基础原料.每个混合物由其它混合物或基础原料组成,不会间接 ...

  3. 【 Gym - 101124E 】Dance Party (数学)

    BUPT2017 wintertraining(15) #4G Gym - 101124 E.Dance Party 题意 有c种颜色,每个颜色最多分配给两个人,有M个男士,F个女士,求至少一对男士同 ...

  4. 【Gym - 101124A】The Baguette Master (数学,几何)

    BUPT2017 wintertraining(15) #4F Gym - 101124A 题意 给定画框宽度,画的四边和一个对角线长度,求画框外沿周长. 题解 过顶点做画框的垂线,每个角都得到两个全 ...

  5. 【 Gym - 101138K 】 The World of Trains (DP)

    BUPT2017 wintertraining(15) #4E Gym - 101138K 题意 N节车厢的火车,每节车厢容量是1~K,那么有\(K^N\)种火车. 求选择D个连续的且容量相同的车厢的 ...

  6. 【 Gym - 101138J 】Valentina and the Gift Tree(树链剖分)

    BUPT2017 wintertraining(15) 4 D Gym - 101138J 数据 题意 n个节点的一棵树,每个节点的权值为g,q个询问,树上的节点U-V,求U到V的路径的最大子段和. ...

  7. 【 Gym - 101138F 】GukiZ Height (数学)

    BUPT2017 wintertraining(15) #4 C Gym - 101138F 题意 初始高度0,目标值h,第i天目标值会下降i,当前高度会改变a[i%n],求高度不小于目标值的最早的时 ...

  8. 【 Gym - 101138D 】Strange Queries (莫队算法)

    BUPT2017 wintertraining(15) #4B Gym - 101138D 题意 a数组大小为n.(1 ≤ n ≤ 50 000) (1 ≤ q ≤ 50 000)(1 ≤ ai ≤  ...

  9. 【Gym - 101164I】Cubes(dfs,剪枝)

    BUPT2017 wintertraining(15) #4 A - I.Cubes Gym - 101164I 题意 将n拆成最少个立方数相加的形式. 题解 根据n的范围,立方数最大不超过400的立 ...

随机推荐

  1. Codeforces Round #267 Div2 C George and Job --DP

    题意:把长度为n的序列分成k个m长的连续小序列,这些连续小序列的和最大是多少. 解法:显然DP. 定义: dp[i][j] 为前 i 个元素分成j个m端,且 i 是第j个的末尾的最大和. 那么有: d ...

  2. 2014 Super Training #9 F A Simple Tree Problem --DFS+线段树

    原题: ZOJ 3686 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3686 这题本来是一个比较水的线段树,结果一个ma ...

  3. SerializeField和Serializable

    Serialize功能 Unity3D 中提供了非常方便的功能可以帮助用户将 成员变量 在Inspector中显示,并且定义Serialize关系. 简单的说,在没有自定义Inspector的情况下所 ...

  4. uGUI练习(六) ScrollView

    练习目标 练习uGUI的滑动组件 一.相关组件 ScrollRect Mask Grid Layout Group Scrollbar 二.步骤 1.创建一个Panel,命名为ScrollRect,添 ...

  5. Android SQLite (二) 基本用法

    在Android开发中SQLite起着很重要的作用,网上SQLite的教程有很多很多,不过那些教程大多数都讲得不是很全面.本人总结了一些SQLite的常用的方法,借着论坛的大赛,跟大家分享分享的. 一 ...

  6. PHP openssl加密扩展使用总结

    1.检查服务器是否已安装了openssl组件,没有则先安装好 openssl version [-a] 2.对称加密 查询openssl支持的对称加密算法 openssl_get_cipher_met ...

  7. php基础26:文件与目录1

    <meta charset="utf-8"> <?php //绝对路径 $path = "E:\AppServ\www\php\/33-catalog. ...

  8. Caffe学习系列(5):其它常用层及参数

    本文讲解一些其它的常用层,包括:softmax_loss层,Inner Product层,accuracy层,reshape层和dropout层及其它们的参数配置. 1.softmax-loss so ...

  9. 对SharePreference的封装

    今天需要用到SharePreference来保存一些设置参数,因为要用到很多次 所以对它进行了封装: public class PrefUtils { public static void putBo ...

  10. Django实际站点项目开发经验谈

    开发了两个月的Django站点正式上线了,看着网站从无到有,从前端到后台,从本地开发到环境部署,一点一滴的堆砌成型,着实带给我不小的乐趣. Django站点介绍: 开发环境:阿里云服务器centos6 ...