• Codeforce 584A


    Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. Find some number that satisfies both of them.

    Your task is: given the n and t print an integer strictly larger than zero consisting of n digits that is divisible by t. If such number doesn't exist, print - 1.

    Input

    The single line contains two numbers, n and t (1 ≤ n ≤ 100, 2 ≤ t ≤ 10) — the length of the number and the number it should be divisible by.

    Output

    Print one such positive number without leading zeroes, — the answer to the problem, or  - 1, if such number doesn't exist. If there are multiple possible answers, you are allowed to print any of them.

    Examples
    input
    3 2
    output
    712
     1 #include <iostream>
     2 #include <stdio.h>
     3 #include <algorithm>
     4 #include <cstring>
     5 #include <sstream>
     6 using namespace std;
     7 const int maxn = 1e9+10;
     8 #define N 10005
     9 int main()
    10 {
    11         int n,t,i;
    12         scanf("%d %d", &n, &t);
    13         if(n==1&&t==10){
    14             printf("-1
    ");
    15         }
    16         else{
    17             if(t==10){
    18                 t=1;
    19             }
    20             printf("%d",t);
    21             for(i=0;i<n-1; i++)  {
    22                 printf("0");
    23             }
    24             printf("
    ");
    25         }
    26     return 0;
    27 }
  • 相关阅读:
    Pipe
    An Easy Problem?!
    Kadj Squares
    Space Ant
    Intersection
    让网页变为可编辑状态
    typescript入门基础
    大家都能看懂的 canvas基础教程
    数组的foreach方法和jQuery中的each方法
    html单行、多行文本溢出隐藏
  • 原文地址:https://www.cnblogs.com/wydxry/p/7253539.html
Copyright © 2020-2023  润新知