【链接】 我是链接,点我呀:)

【题意】

题意

【题解】

如果找到最大的n使得1+2+...+n

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std; const int N = 1e5; ll a,b;
ll n;
int tag[N+10]; int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin >> a >> b;
//(1+n)*n/2
for (n = 0;n*(1+n)/2<=(a+b);n++);
n--;
ll t1 = 0;
for (t1 = 1;t1*(t1+1)/2<=a;t1++);
t1--;
if (t1*(t1+1)/2==a){
cout<<t1<<endl;
for (ll i = 1;i <= t1;i++){
cout<<i<<" ";
}
cout<<endl;
cout<<n-t1<<endl;
for (ll i = t1+1;i <= n;i++){
cout<<i<<" ";
}
}else{
t1++;
ll temp = t1*(t1+1)/2-a;
cout<<t1-1<<endl;
int cnt = 0;
for (ll i = 1;i <= t1;i++)
if (i!=temp){
cout<<i<<" ";
cnt++;
}
if (cnt>0) cout<<endl;
cout<<n-(t1-1)<<endl;
if (n-(t1-1)>0)cout<<temp<<" ";
for (ll i = t1+1;i <= n;i++){
cout<<i<<" ";
}
} return 0;
}

【Codeforces 1031C】Cram Time的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. failed to push some refs to 'https://gitee.com/ftl_663/java-shop.git'

    1.git init 2.git add . 3.git commit  -m "init" 4.git remote add origin  https://gitee.com/ ...

  2. 《windows核心编程系列》十七谈谈dll

    DLL全称dynamic linking library.即动态链接库.广泛应用与windows及其他系统中.因此对dll的深刻了解,对计算机软件开发专业人员来说非常重要. windows中所有API ...

  3. Median Value

    Problem A: Median Value Time Limit: 1 Sec Memory Limit: 128 MB Submit: 874 Solved: 307 [Submit][Stat ...

  4. 【转】【开源下载】基于TCP网络通信的即时聊天系统(IM系统)(c#源码)

    原文链接 强烈关注,学习!

  5. outlook 通讯录分类--2017年1月16日--对联系人分类管理

    outlook功能多,复杂,导致打开界面就晕,通讯录分类 问:在Outlook 中,随着联系人数量的增多,亲朋好友.同事.客户的信息混杂在一起,每次发邮件都要用很长时间才能从联系人列表中找到需要的人. ...

  6. JS格式化工具(转)

    <html> <head> <title>JS格式化工具 </title> <meta http-equiv="content-type ...

  7. 微信小程序flex布局

    一.flex布局基础 二.相对定位和绝对定位   flex的容器和元素   主轴(左-右),交叉轴(上-下)     flex容器属性详解 flex-direction 决定元素的排列方向(默认row ...

  8. css3 transform + deviceorientation实现图片旋转效果

    1. 陀螺仪deviceorientation的使用,参考<关于陀螺仪deviceorientation>https://segmentfault.com/a/11900000071838 ...

  9. VMware虚拟机下载与安装

    VMware下载与安装 一.虚拟机的下载 1.进入VMware官网,点击左侧导航栏中的下载,再点击图中标记的Workstation Pro,如下图所示. 2.根据操作系统选择合适的产品,在这里以Win ...

  10. Node.js——fs常用API

    文件状态 文件删除 文件信息 读取文件夹 文件的截取 创建文件夹 删除目录 文件监视,可以设置监视频率 文件重命名,可以用来剪切文件 注意 fs.open() fs.close() 这是最原始的读写方 ...