链接

\(A,B\)题签到,就完了。

\(C\)题,考虑进位时多进一位,由于是隔一位进的,所以可以发现奇数位和偶数位是相互独立的,那么我们就把奇数位和偶数位单独拉出来组成数字例如:34789,我们单独拉出来的奇数位为:379,单独拉出来的偶数位为48,这样的话我们再将这两个数按照十进制算法正常相加的个数即可。考虑一个数\(x\),若两个有序实数对相加的个数为\(x+1\),那我们最终的答案就是\((x_奇+1)\times(x_偶+1)-2\),因为最后的数不能拆成(n,0)和(0,n),除去这两种。

//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define ls p<<1
#define db double
#define rs p<<1|1
#define P 1000000007
#define ll long long
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define ull unsigned long long
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(x,y,z) for(int x=y;x<=z;++x)
#define fep(x,y,z) for(int x=y;x>=z;--x)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std; inline int read()
{
int x=0,ff=1;
char ch=getchar();
while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
return x*ff;
} int main()
{
//freopen("1.in","r",stdin);
int get(T);
while(T--)
{
int get(n);
ll x1=0,x2=0;
int s=1e9;
rep(i,1,10)
{
if(i%2==1) x1=x1*10+n/s;
else x2=x2*10+n/s;
n%=s;s/=10;
}
putl((x1+1)*(x2+1)-2);
}
return (0^_^0);
}
//以吾之血,铸吾最后的亡魂.

关于\(D\)题,

简化题意就是给定你一个数字\(s\)和\(n\),让你构造一个长度为\(n\)的序列,使得序列中的元素和为\(s\)。并且使得这个序列中的元素转化为\(11\)进制后的和最大。

发现我们最优的情况就是使得拆开后的数字在各个数位上相加任然和原数相等,但若不等的话,我们只能将拆开了。贪心的从低位向高位拆就行。

//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define ls p<<1
#define db double
#define rs p<<1|1
#define P 1000000007
#define ll long long
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define ull unsigned long long
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(x,y,z) for(int x=y;x<=z;++x)
#define fep(x,y,z) for(int x=y;x>=z;--x)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
ll p[20]; inline int read()
{
int x=0,ff=1;
char ch=getchar();
while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
return x*ff;
} int main()
{
//freopen("1.in","r",stdin);
int get(T);
while(T--)
{
ll get(s),get(n);
ll now=s,cnt=0;
rep(i,1,10)
{
p[i]=now%10;
now/=10;
cnt+=p[i];
}
while(cnt<n)
{
rep(i,2,10)
{
if(p[i])
{
p[i]--;
p[i-1]+=10;
cnt+=9;
break;
}
}
}
ll pz=1;n--;
rep(i,1,10)
{
rep(j,1,min(n,p[i])) printf("%lld ",1*pz);
s-=min(n,p[i])*pz;n-=min(n,p[i]);
pz*=10;
}
printf("%lld\n",s);
}
return (0^_^0);
}
//以吾之血,铸吾最后的亡魂.

Codeforces Round #742 (Div. 2)题解的更多相关文章

  1. Codeforces Round #182 (Div. 1)题解【ABCD】

    Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...

  2. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  3. Codeforces Round #525 (Div. 2)题解

    Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...

  4. Codeforces Round #528 (Div. 2)题解

    Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...

  5. Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F

    Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...

  6. Codeforces Round #677 (Div. 3) 题解

    Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...

  7. Codeforces Round #665 (Div. 2) 题解

    Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...

  8. Codeforces Round #160 (Div. 1) 题解【ABCD】

    Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...

  9. Codeforces Round #383 (Div. 2) 题解【ABCDE】

    Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...

随机推荐

  1. pythonGUI-PySide2的使用笔记

    用python开发跨平台的图形化界面,主流的有3种选择: Tkinter 基于Tk的Python库,Python官方标准库,稳定.发布程序较小,缺点是控件相对较少. wxPython 基于wxWidg ...

  2. 自己实现一个Controller——精简型

    写在最前 controller-manager作为K8S master的其中一个组件,负责众多controller的启动和终止,这些controller负责监控着k8s中各种资源,执行调谐,使他们的实 ...

  3. CentOS8部署tftp

    tftp:简单文本传输协议,而ftp:文本传输协议.可以把tftp看成是ftp的精简版.tftp用于免登录传输小文件,tftp服务端监听在udp协议的69端口tftp简单的工作原理: tftp服务端与 ...

  4. TypeScript与面向对象

    目录 1.引 2.类(class) 3.构造函数和this 4.继承 5.super 6.抽象类 7.接口 8.属性的封装 9.泛型 1.引 简而言之就是程序之中所有的操作都需要通过对象来完成.一切操 ...

  5. PHP中的“重载”是个啥?

    很多面试官在面试的时候都会问一些面向对象的问题,面向对象的三大特性中,多态最主要的实现方式就是方法的重载和重写.但是在PHP中,只有重写,并没有完全的重载能力的实现. 重写,子类重写父类方法. // ...

  6. 全面分析 Vue 的 computed 和 watch 的区别

    一.computed介绍 computed 用来监控自己定义的变量,该变量在 data 内没有声明,直接在 computed 里面定义,页面上可直接使用. //基础使用 {{msg}} <inp ...

  7. 博客主题-Next风格

    适配方法 下载压缩包,按照文件名将内容复制粘贴到对应框中即可. 注意事项 请将主题设置为custom 禁用默认css 下载连接 Next.rar version:2020-07-10 next.rar ...

  8. english note(6.17to6.23)

    6.17 http://www.51voa.com/VOA_Special_English/are-these-us-treasures-about-to-be-destroyed-82260_1.h ...

  9. P6499-[COCI2016-2017#2]Burza【状压dp】

    正题 题目链接:https://www.luogu.com.cn/problem/P6499 题目大意 \(n\)个点的一棵树,开始有一个棋子在根处,开始先手选择一个点封锁,然后后手封锁棋子所在点然后 ...

  10. 解决报错:The import javax.servlet.annotation cannot be resolved

    maven项目,引入javax.servlet.annotation.WebServlet的jar包,使用@WebServlet注解来实现对传统web.xml中servlet和url的映射 报错:Th ...