CF 277.5 C.Given Length and Sum of Digits.. 构造
2024-10-16 23:40:21
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
int a[];
int main()
{
int m,s;
cin>>m>>s;
if(m==&&s==)
{
cout<<"0 0"<<endl;
return ;
}
if(s==)
{
cout<<"-1 -1"<<endl;
return ;
}
if(s>*m)
{
cout<<"-1 -1"<<endl;
return ;
}
int t=s-;//精湛的-1 屌不屌?
for(int i=;i<m;i++)
{
int r=min(t,);
a[i]=r;
t-=r;
}
a[m-]++;
for(int i=m-;i>=;i--)
cout<<a[i];
cout<<" ";
t=s;
for(int i=;i<m;i++)
{
int r=min(,t);
cout<<r;
t-=r;
}
cout<<endl;
return ;
}
最新文章
- Alcatraz 的安装和删除
- Spring-AOP实践 - 统计访问时间
- C#导出csv文件
- VS一次删除多个窗体后报错
- 一次Oracle 11g+FluentNHibernate AutoMapping组合尝试
- Maven打包跳过测试
- git 常用命令使用
- windows下的unix工具集:UnxUtils
- windows系统mysql定时自动备份
- Linux I/O模型
- Java API —— BigInteger类
- 【概率dp,难度3颗星】hdu-5001(2014鞍山网络赛)
- HDOJ 1214 圆桌会议
- 设计模式(二): BUILDER生成器模式 -- 创建型模式
- 对于笔试题--“good and abc”的理解
- ORA-00119/ORA-00132
- js-将一个对象转换成一个新的对象
- Asp.Net MVC 获取当前 Controller Action Area
- python爬虫-基础入门-爬取整个网站《2》
- JavaScript ES6格式化字符串方法