zoukankan      html  css  js  c++  java
  • codeforces Vasya and Digital Root

    /*
     * c.cpp
     *
     *  Created on: 2013-10-7
     *      Author: wangzhu
     */
    
    /**
     * 当时比赛时,想得复杂了,也想偏了,
     * 1)、写出来之后,结果达到了预期的结果,不过和给出的输出不一样,糊涂了
     * 2)、想法太复杂了
     *
     * 比赛之后,看了别人的,原来如此:
     *结果不唯一,
     *当根为0,但位数大于1,则没有结果,因为位数大于1,最后的根必然大于0,故没有结果;
     *当不为0,则应是根后面跟位数减去一个零,即是结果。
     */
    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main() {
        freopen("data.in", "r", stdin);
        freopen("data.out", "w", stdout);
        int k,d;
        while(~scanf("%d%d",&k,&d)) {
            if(d == 0 && ( k > 1)) {
                printf("No solution
    ");
            } else {
                printf("%d",d);
                for(int i = 1;i < k;i++) {
                    printf("0");
                }
                printf("
    ");
            }
        }
        return 0;
    }
  • 相关阅读:
    分糖果
    数字游戏
    错误票据
    包子凑数
    带分数
    翻硬币
    核桃的数量
    快速幂
    公倍数与素数筛选
    mysql 查询当天当周当月的数据
  • 原文地址:https://www.cnblogs.com/xiaoxian1369/p/3367633.html
Copyright © 2011-2022 走看看