编程介的小学生 2018-12-04 14:16 采纳率: 20.5%
浏览 286
已采纳

请大神看看这个问题用C语言的解题思路是怎样实现的

Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he asks rikka to have some practice on codeforces. Then she opens the problem B:

Given an integer K, she needs to come up with an sequence of integers A satisfying that the number of different continuous subsequence of A is equal to k.

Two continuous subsequences a, b are different if and only if one of the following conditions is satisfied:

  1. The length of a is not equal to the length of b.

  2. There is at least one t that at≠bt, where at means the t-th element of a and bt means the t-th element of b.

Unfortunately, it is too difficult for Rikka. Can you help her?

Input
There are at most 20 testcases,each testcase only contains a single integer K (1≤K≤109)

Output
For each testcase print two lines.

The first line contains one integers n (n≤min(K,105)).

The second line contains n space-separated integer Ai (1≤Ai≤n) - the sequence you find.

Sample Input
10

Sample Output
4
1 2 3 4

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-03-28 10:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看