D - Decrease (Contestant ver.)


Time limit : 2sec / Memory limit : 256MB

Score : 600 points

Problem Statement

We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N−1 or smaller.

  • Determine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.

It can be proved that the largest element in the sequence becomes N−1 or smaller after a finite number of operations.

You are given an integer K. Find an integer sequence ai such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.

Constraints

  • 0≤K≤50×1016

Input

Input is given from Standard Input in the following format:

K

Output

Print a solution in the following format:

N
a1 a2 ... aN

Here, 2≤N≤50 and 0≤ai≤1016+1000 must hold.


Sample Input 1

Copy
0

Sample Output 1

Copy
4
3 3 3 3

Sample Input 2

Copy
1

Sample Output 2

Copy
3
1 0 3

Sample Input 3

Copy
2

Sample Output 3

Copy
2
2 2

The operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].


Sample Input 4

Copy
3

Sample Output 4

Copy
7
27 0 0 0 0 0 0

Sample Input 5

Copy
1234567894848

Sample Output 5

Copy
10
1000 193 256 777 0 1 1192 1234567891011 48 425

直接定义数组长为50,k=0:0,1,2,............49;
k=1:50,0,1,2,3,..............48;
k=2:49,50,1,2,3..............47;
.......
k=50:1,2,3,..............48,49,50;
周期为50
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll n;
ll a[];
int main()
{
scanf("%lld",&n);
for(int i=;i<=;i++)
{
a[i]=n/+i-;
}
n%=;
for(int i=;i<=n;i++)
{
for(int j=;j<=;j++)
{
a[j]--;
}
a[i]+=;
}
printf("50\n");
for(int i=;i<=;i++)
{
if(i!=) printf(" ");
printf("%lld",a[i]);
}
printf("\n");
return ;
}

Atcoder At Beginner Contest 068 D - Decrease (Contestant ver.)的更多相关文章

  1. 【构造】AtCoder Regular Contest 079 D - Decrease (Contestant ver.)

    从n个t变化到n个t-1,恰好要n步,并且其中每一步的max值都>=t,所以把50个49当成最终局面,从这里开始,根据输入的K计算初始局面即可. #include<cstdio> # ...

  2. Atcoder At Beginner Contest 068 C - Cat Snuke and a Voyage

    C - Cat Snuke and a Voyage Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem State ...

  3. AtCoder Beginner Contest 068 ABCD题

    A - ABCxxx Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement This contes ...

  4. AtCoder Beginner Contest 068

    A - ABCxxx 题意: 给出n,输出“ABCn”就可以了,纯水题. B - Break Number 题意: 给出n,找出从1到n的闭区间内能够被2整除最多次的数. 思路: 直接模拟. 代码: ...

  5. Atcoder arc079 D Decrease (Contestant ver.) (逆推)

    D - Decrease (Contestant ver.) Time limit : 2sec / Memory limit : 256MB Score : 600 points Problem S ...

  6. Atcoder AtCoder Regular Contest 079 E - Decrease (Judge ver.)

    E - Decrease (Judge ver.) Time limit : 2sec / Memory limit : 256MB Score : 600 points Problem Statem ...

  7. 【贪心】AtCoder Regular Contest 079 E - Decrease (Judge ver.)

    每次将最大的数减到n以下,如此循环直到符合题意. 复杂度大概是n*n*log?(?). #include<cstdio> #include<iostream> #include ...

  8. atcoder beginner contest 251(D-E)

    Tasks - Panasonic Programming Contest 2022(AtCoder Beginner Contest 251)\ D - At Most 3 (Contestant ...

  9. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

随机推荐

  1. ubuntu中开启、关闭防火墙

    1.关闭ubuntu的防火墙        ufw disable 开启防火墙 ufw enable 2.卸载了iptables        apt-get remove iptables 3.关闭 ...

  2. [Python] Slice the data with pandas

    For example we have dataframe like this: SPY AAPL IBM GOOG GLD 2017-01-03 222.073914 114.311760 160. ...

  3. ubuntu下安装RemixOS双系统(Android x86)

    这篇文章主要讲在怎样在ubuntu下安装RemixOS pc版(Android x86版本号),下面两种做法的思路都适合安装不论什么版本号的Android x86版本号到ubuntu系统上,仅仅须要改 ...

  4. 【POJ 2195】 Going Home(KM算法求最小权匹配)

    [POJ 2195] Going Home(KM算法求最小权匹配) Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submiss ...

  5. modSecurity规则学习(六)——检测模式

    传统检测模式-自主规则 传统检测模式所有规则都是“闭环”的模式.就像HTTP本身一样,单独的规则是无状态的.这意味着规则之间不共享信息,每个规则都没有关于任何先前规则匹配的信息.它仅使用其当前的单个规 ...

  6. Codeforces--602A--Two Bases(水)

    Two Bases Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit St ...

  7. Vue官方文档中的camelCased (驼峰式) 命名与 kebab-case

    因为html特性中 元素的 prop是不区分大小写的 所以不管html中怎么大写小写变化,下面的组件的prop应该写成小写 Vue中有这样一种设定: props中如果使用为kebab-case命名方式 ...

  8. 2018 NOIP备战计划

    2018 NOIP目标 (1)刷完紫书数论习题 (2)听51nod讲座和习题,根据其知识结构来备战. (3)刷完紫书动规 (4)初赛前两个星期左右开始复习 刷紫书动规的时候感觉偏难,进步缓慢.应该自己 ...

  9. 实现IE下兼容CSS3的圆角效果

    有些CSS3的牛逼的效果在IE下展示不出来是最烦人的啦,在项目中做的圆角效果到了IE下一堆方块....忒尴尬了...,找了个替代解决方案 1.首先下载一个js插件PIE.js百度一搜都是的,我也就不写 ...

  10. hzwer 模拟题 祖孙询问

    祖孙询问 题目描述 已知一棵n个节点的有根树.有m个询问.每个询问给出了一对节点的编号x和y,询问x与y的祖孙关系. 输入输出格式 输入格式: 输入第一行包括一个整数n表示节点个数. 接下来n行每行一 ...