#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 ;
}

CF 277.5 C.Given Length and Sum of Digits.. 构造的更多相关文章

  1. codeforces#277.5 C. Given Length and Sum of Digits

    C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabyte ...

  2. Codeforces Round #277.5 (Div. 2)C——Given Length and Sum of Digits...

    C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabyte ...

  3. Codeforces Round #277.5 (Div. 2)-C. Given Length and Sum of Digits...

    http://codeforces.com/problemset/problem/489/C C. Given Length and Sum of Digits... time limit per t ...

  4. CodeForces 489C Given Length and Sum of Digits... (贪心)

    Given Length and Sum of Digits... 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/F Descr ...

  5. CodeForces 489C Given Length and Sum of Digits... (dfs)

    C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabyte ...

  6. B - Given Length and Sum of Digits... CodeForces - 489C (贪心)

    You have a positive integer m and a non-negative integer s. Your task is to find the smallest and th ...

  7. CodeForces 489C (贪心) Given Length and Sum of Digits...

    题意: 找出m位且各个数位数字之和为s的最大和最小整数,不包括前导0(比如说003是非法的),但0是可以的. 分析: 这题是用贪心来做的,同样是m位数,前面的数字越大这个数就越大. 所以写一个can( ...

  8. Codeforces 489C Given Length and Sum of Digits...

    m位长度,S为各位的和 利用贪心的思想逐位判断过去即可 详细的注释已经在代码里啦~ //#pragma comment(linker, "/STACK:16777216") //f ...

  9. codeforces 489C.Given Length and Sum of Digits... 解题报告

    题目链接:http://codeforces.com/problemset/problem/489/C 题目意思:给出 m 和 s,需要构造最大和最小的数.满足长度都为 m,每一位的数字之和等于 s. ...

随机推荐

  1. Android Bander设计与实现 - 设计

    Binder Android IPC Linux 内核 驱动 摘要 Binder是Android系统进程间通信(IPC)方式之一.Linux已经拥有管道,system V IPC,socket等IPC ...

  2. aarch64_l2

    libfreehand-devel-0.1.1-5.fc26.aarch64.rpm 2017-05-23 07:16 26K fedora Mirroring Project libfreehand ...

  3. 使用Python扫描网络MAC地址对应的IP地址

    #!/usr/bin/env python # -*- coding: utf-8 -*- from scapy.all import srp,Ether,ARP,conf ipscan='192.1 ...

  4. overridePendingTransition()使用

    实现两个 Activity 切换时的动画.在Activity中使用有两个参数:进入动画和出去的动画. 注意1.必须在 StartActivity()  或 finish() 之后立即调用.2.而且在 ...

  5. OSGiBundle出现 Could not find bundle: org.eclipse.equinox.console的解决方案

    按照网上教程创建OSGI HelloWorld实例配置run configuration时出现Could not find bundle: org.eclipse.equinox.console 和C ...

  6. simple_tag

    from django.template import Library register = Library() @register.simple_tag def func(arg): return ...

  7. C++两个类相互包含引用的问题

    在构造自己的类时,有可能会碰到两个类之间的相互引用问题,例如:定义了类A类B,A中使用了B定义的类型,B中也使用了A定义的类型 class A { B b; } class B { A* a; } 请 ...

  8. 关于SQLserver的索引的一些脚本

    --判断无用的索引: SELECT TOP 30 DB_NAME() AS DatabaseName , '[' + SCHEMA_NAME(o.Schema_ID) + ']' + '.' + '[ ...

  9. php 根据ip获取城市以及网络运营商名称(利用qqwry.dat)

    根据用户IP地址判定出所在城市以及网络运营商 qqwry.dat下载地址:http://files.cnblogs.com/guangxiaoluo/qqwry.rar  解压出来即可 //获取用户真 ...

  10. 2017冬季24集训模拟题-24星球的末日(Floyd)

    24 星球的末日[问题描述]24 星球的世界末日就要到了 , 可是诺亚方舟还没有制造完成 . 为了制造诺亚方舟这个星球上的所有国家都站在统一战线 . 现在一共有n个国家 , 一个国家到另一个国家都有一 ...