A.

Input

The only line contains the integer xx (1≤x≤100)(1≤x≤100).

Output

You should output two integers aa and bb, satisfying the given conditions, separated by a space. If no pair of integers satisfy the conditions above, print "-1" (without quotes).

Examples

Input

10

Output

6 3

Input

1

Output

-1

解题报告:

就是给你一个x,让你构造一个a和b,满足和x的这仨关系就行了。

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;int main()
{int x,a,b;cin>>x;int flag = 0;for(int i = 1; i<=x; i++) {for(int j = i; j<=x; j+=i) {if(i*j>x && j/i < x) {flag = 1;a=j;b=i;break;}}if(flag) break;}if(flag) printf("%d %d\n",a,b);else puts("-1");return 0 ;}

B.

给你n个数的数组,给一个k。让你重复执行k次下列操作:每次选中序列中不为0的最小的数并输出,然后把序列中所有非零的数都减去这个选中的数。如果序列已经都是0了,那就输出0.

Examples

Input

3 5
1 2 3

Output

1
1
1
0
0

Input

4 2
10 3 5 3

Output

3
2

Note

In the first sample:

In the first step: the array is [1,2,3][1,2,3], so the minimum non-zero element is 1.

In the second step: the array is [0,1,2][0,1,2], so the minimum non-zero element is 1.

In the third step: the array is [0,0,1][0,0,1], so the minimum non-zero element is 1.

In the fourth and fifth step: the array is [0,0,0][0,0,0], so we printed 0.

In the second sample:

In the first step: the array is [10,3,5,3][10,3,5,3], so the minimum non-zero element is 3.

In the second step: the array is [7,0,2,0][7,0,2,0], so the minimum non-zero element is 2.

解题报告:

先别看哪个Node,,有的时候会误导你的思路。。其实这题就是将减的数给可持久化一下、、因为你想啊你总不能减一个数,就将序列中的数都变化一下吧,,所以解决方法就是用一个sub来动态记录变化的数的值。为啥可以这样呢?因为你虽然要变化整个数组中的值,,但是其实你就算不变化,,也不会影响下次你取数组中的最小值(因为大家都减同一个数,相对的大小关系肯定没变啊)所以就用一个变量记录就行了。

AC代码1:(排序版)

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
ll a[MAX];
int main() {int n,k;cin>>n>>k;for(int i=1; i<=n; i++) scanf("%lld",a+i);ll sub=0;sort(a+1,a+n+1);for(int i=1,j=1;j<=k;i++,j++) {if(i>n) {printf("0\n");} else {while(1) {if(a[i]!=sub) break;i++;if(i > n) {printf("0\n");break;}}if(i<=n) {a[i]-=sub;printf("%lld\n",a[i]);sub+=a[i];}}}return 0;
}

或者用优先队列也可以写:

AC代码2:

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define ll long long
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
priority_queue<int, vector<int>, greater<int> > pq;
int n,k;
int main() {cin>>n>>k;for(int i = 1,tmp; i <= n; i ++) {scanf("%d",&tmp);if(tmp) pq.push(tmp);}int sub = 0;while(k--) {if(!pq.empty()) {int cur = pq.top();while(cur - sub == 0 && !pq.empty()) {pq.pop();cur=pq.top();}printf("%d\n",cur-sub);sub += (cur-sub);}else puts("0");}return 0;
}

不过更适合我的方式其实是先判断一堆直到只能变成0。然后再看看剩余的次数是否大于0,如果大于0再输出k次的0就行了、


C.

不想写题意了。。**构造一眼题

You're given an array aa of length nn. You can perform the following operations on it:

  • choose an index ii (1≤i≤n)(1≤i≤n), an integer xx (0≤x≤106)(0≤x≤106), and replace ajaj with aj+xaj+x for all (1≤j≤i)(1≤j≤i), which means add xx to all the elements in the prefix ending at ii.
  • choose an index ii (1≤i≤n)(1≤i≤n), an integer xx (1≤x≤106)(1≤x≤106), and replace ajaj with aj%xaj%x for all (1≤j≤i)(1≤j≤i), which means replace every element in the prefix ending at ii with the remainder after dividing it by xx.

Can you make the array strictly increasing in no more than n+1n+1 operations?

Input

The first line contains an integer nn (1≤n≤2000)(1≤n≤2000), the number of elements in the array aa.

The second line contains nn space-separated integers a1a1, a2a2, ……, anan (0≤ai≤105)(0≤ai≤105), the elements of the array aa.

Output

On the first line, print the number of operations you wish to perform. On the next lines, you should print the operations.

To print an adding operation, use the format "11 ii xx"; to print a modding operation, use the format "22 ii xx". If ii or xx don't satisfy the limitations above, or you use more than n+1n+1 operations, you'll get wrong answer verdict.

Examples

Input

3
1 2 3

Output

0

Input

3
7 6 3

Output

2
1 1 1
2 2 4

Note

In the first sample, the array is already increasing so we don't need any operations.

In the second sample:

In the first step: the array becomes [8,6,3][8,6,3].

In the second step: the array becomes [0,2,3][0,2,3].

好吧我还是写一下题意。。就是说给你n个数,给你两种操作:1.任取一个x,让区间内所有的数都加上这个x。2.任取一个x,让区间内所有的数都取模这个x。(其中x<=1e6)。使得这个序列变成一个严格递增序列,让你输出每次操作是什么,和怎么操作、、

解题报告:

1分钟出标算,,10分钟WA两发,,刚开始这个大数去了1e7,,(没读题),,后来WA1,改成1e6,感觉该没问题了吧,WA2,,发现后面在取模的时候去的x会超过1e6,,再改成5e5,AC。。

其实这题上来就取个5000左右就行了啊。。

不难构造,,题意都提示的很明显了,,n+1次操作,那肯定猜一个n次一个1次呗,,然后不难想到加一个大数,然后每次都取模,让他构造成一个1~n的序列就完事了。

(白白丢掉100分啊,,,心疼)(另外,应该输出a[i]-i,,别写成了a[i]-1,,,)

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
ll a[MAX];
int main()
{int n;cin>>n;for(int i = 1; i<=n; i++) scanf("%lld",a+i); printf("%d\n",n+1);printf("1 %d 500000\n",n);for(int i = 1; i<=n; i++) a[i] += 500000;for(int i = 1; i<=n; i++) {printf("2 %d %lld\n",i,a[i]-i);}return 0 ;}

D.

未补。抽空学学交互题吧、、

*【CodeForces - 1088 ABC】套题比赛,A水题B模拟C构造D交互相关推荐

  1. CodeForces Canada Cup 2016 A、B水题 _(:з」∠)_

    哭哭哭哭哭哭哭 又降了4...... 这次吸取的教训是...本来就是个做题慢的傻逼....一定要准时题目一开就开始做.....不然就等着降名次吧,..... 开始四十多分钟才开进去的.....再给我四 ...

  2. c语言题-牛牛做水题

    牛牛喜欢做题.但他不喜欢做难题,喜欢做水题. 对于一个题号为的题而言,题目的难度为的所有因子之和除以.牛牛认为难度小于2的题目都是水题. 例如: 编号为25的题目,其难度为(1+5+25)/25=1. ...

  3. Codeforces Round #499 (Div. 2) Problem-A-Stages(水题纠错)

    CF链接  http://codeforces.com/contest/1011/problem/A Natasha is going to fly to Mars. She needs to bui ...

  4. Educational Codeforces Round 12 A. Buses Between Cities 水题

    A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run ...

  5. 【 CodeForces - 864B】Polycarp and Letters(水题,字符串,有坑)

    题干: Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string sconsisting o ...

  6. CodeForces 444C. DZY Loves Physics(枚举+水题)

    转载请注明出处:http://blog.csdn.net/u012860063/article/details/37509207 题目链接:http://codeforces.com/contest/ ...

  7. CodeForces - 1228B Filling the Grid(思维,水题)

    题目链接:点击查看 题目大意:给出一个n*m的矩阵,每个格子可以涂成黑色或白色,再给出n个数a[i]以及m个数b[i],a[i]表示第i行前a[i]个格子都是黑色的,第a[i]+1个数是白色的,其余的 ...

  8. CodeForces - 670C Cinema(离散化+排序/map,水题)

    题目链接:点击查看 题目大意:有m部正在上映的电影,每部电影的语音和字幕都采用不同的语言,用一个int范围内的整数来表示语言.有n个人相约在一起去看其中一部电影,每个人只会一种语言,如果一个人能听懂电 ...

  9. 【CodeForces - 255A】Greg's Workout (水题)

    题干: Greg is a beginner bodybuilder. Today the gym coach gave him the training plan. All it had was n ...

最新文章

  1. 简要说明__python3中的进程/线程/协程
  2. 轻松搞定项目中的空指针异常Caused by: java.lang.NullPointerException: null
  3. scss安装_安装了这9个免费PS插件后,终于能正常时间下班了……
  4. pdf导入ps颜色太浅_分享五个免费的pdf转换器,你更想选择哪一款?
  5. littlevgl抗锯齿_「VGL」littlevGL:字体与汉字 - seo实验室
  6. codeforces 339A-C语言解题报告
  7. OpenCV---ROI(region of interest)和泛洪填充
  8. Ant 构建文件的一种写法
  9. Welcome to NHibernate
  10. ajax跨域.pdf,探秘ajax跨域请求.pdf
  11. Python资源下载
  12. mysql毫秒丢失_MySQL JDBC 更新数据丢失毫秒精度
  13. 数据结构:图的深度优先遍历和广度优先遍历
  14. SAP PO750 Process Orchestration 安装及初始化(刘欣)
  15. 格(Lattice)基础(一)
  16. 浅谈jodaTime 的使用
  17. Qt开发——网络编程UDP网络广播软件之服务器端
  18. QQ音乐PC端保存歌手写真的方法
  19. 前端学习——CSS布局
  20. 学jQuery ,认识jQuery

热门文章

  1. 数据结构四——散列表(上)
  2. [Android]安装 Android Studio 第一行Android代码
  3. 源码安装的php如何启动脚本,PHP源码编译安装管理常用脚本
  4. WEBSHELL权限提升 菜菜
  5. android 编译主机,Android】源码编译 ---zzz
  6. cpp [Error] reference to ‘count‘ is ambiguous(全局变量的使用模糊不清)
  7. c++ qt5范例开发大全_使用yocto工具编译qt5.9.6总结
  8. 友益文书类似软件_团队成员分享 | 港中文翻译学姐:硬件不够,软件来凑;心之所愿,无所不能...
  9. python股票交易模型_如何用Python建模GGM模型并对股票估值?
  10. PlacementBrowser源码分析