编程介的小学生 2019-03-24 06:52 采纳率: 20.5%
浏览 373

两个连续子序列的匹配的问题,利用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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
    • ¥15 onvif+openssl,vs2022编译openssl64
    • ¥15 iOS 自定义输入法-第三方输入法
    • ¥15 很想要一个很好的答案或提示
    • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
    • ¥15 怀疑手机被监控,请问怎么解决和防止
    • ¥15 Qt下使用tcp获取数据的详细操作